summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2013-02-04Merge branch 'nd/edit-branch-desc-while-detached' into maintLibravatar Junio C Hamano1-4/+4
Attempt to "branch --edit-description" an existing branch, while being on a detached HEAD, errored out. * nd/edit-branch-desc-while-detached: branch: no detached HEAD check when editing another branch's description
2013-02-04Merge branch 'jc/help' into maintLibravatar Junio C Hamano1-18/+0
* jc/help: help: include <common-cmds.h> only in one file
2013-02-04Merge branch 'jc/merge-blobs' into maintLibravatar Junio C Hamano2-37/+59
* jc/merge-blobs: Makefile: Replace merge-file.h with merge-blobs.h in LIB_H merge-tree: fix d/f conflicts merge-tree: add comments to clarify what these functions are doing merge-tree: lose unused "resolve_directories" merge-tree: lose unused "flags" from merge_list Which merge_file() function do you mean?
2013-01-30branch: no detached HEAD check when editing another branch's descriptionLibravatar Nguyễn Thái Ngọc Duy1-4/+4
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-18help: include <common-cmds.h> only in one fileLibravatar Junio C Hamano1-18/+0
This header not only declares but also defines the contents of the array that holds the list of command names and help text. Do not include it in multiple places to waste text space. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-14Merge branch 'jl/interrupt-clone-remove-separate-git-dir' into maintLibravatar Junio C Hamano1-1/+3
When "git clone --separate-git-dir=$over_there" is interrupted, it failed to remove the real location of the $GIT_DIR it created. This was most visible when interrupting a submodule update. * jl/interrupt-clone-remove-separate-git-dir: clone: support atomic operation with --separate-git-dir
2013-01-14Merge branch 'jc/maint-fmt-merge-msg-no-edit-lose-credit' into maintLibravatar Junio C Hamano2-7/+15
"git merge --no-edit" computed who were involved in the work done on the side branch, even though that information is to be discarded without getting seen in the editor. * jc/maint-fmt-merge-msg-no-edit-lose-credit: merge --no-edit: do not credit people involved in the side branch
2013-01-14Merge branch 'jc/apply-trailing-blank-removal' into maintLibravatar Junio C Hamano1-6/+17
"git apply" misbehaved when fixing whitespace breakages by removing excess trailing blank lines. * jc/apply-trailing-blank-removal: apply.c:update_pre_post_images(): the preimage can be truncated
2013-01-11Merge branch 'ap/merge-stop-at-prepare-commit-msg-failure' into maintLibravatar Junio C Hamano1-2/+3
"git merge" started calling prepare-commit-msg hook like "git commit" does some time ago, but forgot to pay attention to the exit status of the hook. * ap/merge-stop-at-prepare-commit-msg-failure: merge: Honor prepare-commit-msg return code
2013-01-10Merge branch 'sp/shortlog-missing-lf' into maintLibravatar Junio C Hamano1-3/+2
* sp/shortlog-missing-lf: strbuf_add_wrapped*(): Remove unused return value shortlog: fix wrapping lines of wraplen
2013-01-05clone: support atomic operation with --separate-git-dirLibravatar Jens Lehmann1-1/+3
Since b57fb80a7d (init, clone: support --separate-git-dir for .git file) git clone supports the --separate-git-dir option to create the git dir outside the work tree. But when that option is used, the git dir won't be deleted in case the clone fails like it would be without this option. This makes clone lose its atomicity as in case of a failure a partly set up git dir is left behind. A real world example where this leads to problems is when "git submodule update" fails to clone a submodule and later calls to "git submodule update" stumble over the partially set up git dir and try to revive the submodule from there, which then fails with a not very user friendly error message. Fix that by updating the junk_git_dir variable (used to remember if and what git dir should be removed in case of failure) to the new value given with the --seperate-git-dir option. Also add a test for this to t5600 (and while at it fix the former last test to not cd into a directory to test for its existence but use "test -d" instead). Reported-by: Manlio Perillo <manlio.perillo@gmail.com> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-03merge: Honor prepare-commit-msg return codeLibravatar Antoine Pelisse1-2/+3
65969d4 (merge: honor prepare-commit-msg hook, 2011-02-14) tried to make "git commit" and "git merge" consistent, because a merge that required user assistance has to be concluded with "git commit", but back then only "git commit" triggered prepare-commit-msg hook. When it added a call to run the prepare-commit-msg hook, however, it forgot to check the exit code from the hook like "git commit" does, and ended up replacing one inconsistency with another. When prepare-commit-msg hook that is run from "git merge" exits with a non-zero status, abort the commit. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28merge --no-edit: do not credit people involved in the side branchLibravatar Junio C Hamano2-7/+15
The credit lines "By" and "Via" to credit authors and committers for their contributions on the side branch are meant as a hint to the integrator to decide whom to mention in the log message text. After the integrator saves the message in the editor, they are meant to go away and that is why they are commented out. When a merge is recorded without editing the generated message, however, its contents do not go through the normal stripspace() and these lines are left in the merge. Stop producing them when we know the merge is going to be recorded without editing, i.e. when --no-edit is given. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-26merge-tree: fix d/f conflictsLibravatar Junio C Hamano1-32/+40
The previous commit documented two known breakages revolving around a case where one side flips a tree into a blob (or vice versa), where the original code simply gets confused and feeds a mixture of trees and blobs into either the recursive merge-tree (and recursing into the blob will fail) or three-way merge (and merging tree contents together with blobs will fail). Fix it by feeding trees (and only trees) into the recursive merge-tree machinery and blobs (and only blobs) into the three-way content level merge machinery separately; when this happens, the entire merge has to be marked as conflicting at the structure level. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-26merge-tree: add comments to clarify what these functions are doingLibravatar Junio C Hamano1-4/+22
Rename the "branch1" parameter given to resolve() to "ours", to clarify what is going on. Also, annotate the unresolved_directory() function with some comments to show what decisions are made in each step, and highlight two bugs that need to be fixed. Add two tests to t4300 to illustrate these bugs. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-26merge-tree: lose unused "resolve_directories"Libravatar Junio C Hamano1-3/+0
This option is always set; simplify. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-26merge-tree: lose unused "flags" from merge_listLibravatar Junio C Hamano1-2/+1
Drop the unused field from the structure. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-13Merge branch 'maint'Libravatar Junio C Hamano1-3/+3
2012-12-13Fix sizeof usage in get_permutationsLibravatar Matthew Daley1-3/+3
Currently it gets the size of an otherwise unrelated, unused variable instead of the expected struct size. Signed-off-by: Matthew Daley <mattjd@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-11shortlog: fix wrapping lines of wraplenLibravatar Steffen Prohaska1-3/+2
A recent commit [1] fixed a off-by-one wrapping error. As a side-effect, the conditional in add_wrapped_shortlog_msg() to decide whether to append a newline needs to be removed. The function should always append a newline, which was the case before the off-by-one fix, because strbuf_add_wrapped_text() never returns a value of wraplen; when it returns wraplen, the string does not end with a newline, so this caller needs to add one anyway. [1] 14e1a4e1ff70aff36db3f5d2a8b806efd0134d50 utf8: fix off-by-one wrapping of text Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-09Which merge_file() function do you mean?Libravatar Junio C Hamano2-4/+4
There are two different static functions and one global function, all of them called "merge_file()", with different signatures and purposes. Rename them all to reduce confusion in "git grep" output: * Rename the static one in merge-index to "merge_one_path(const char *path)" as that function is about asking an external command to resolve conflicts in one path. * Rename the global one in merge-file.c that is only used by merge-tree to "merge_blobs()", as the function takes three blobs and returns the merged result only in-core, without doing anything to the filesystem. * Rename the one in merge-recursive to "merge_one_file()", just to be fair. Also rename merge-file.[ch] to merge-blobs.[ch]. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-07Merge branch 'jc/same-encoding' into maintLibravatar Junio C Hamano1-1/+2
Various codepaths checked if two encoding names are the same using ad-hoc code and some of them ended up asking iconv() to convert between "utf8" and "UTF-8". The former is not a valid way to spell the encoding name, but often people use it by mistake, and we equated them in some but not all codepaths. Introduce a new helper function to make these codepaths consistent. * jc/same-encoding: reencode_string(): introduce and use same_encoding()
2012-11-29Merge branch 'jk/send-email-sender-prompt'Libravatar Junio C Hamano1-2/+2
General clean-ups in various areas, originally written to support a patch that later turned out to be unneeded. * jk/send-email-sender-prompt: t9001: check send-email behavior with implicit sender t: add tests for "git var" ident: keep separate "explicit" flags for author and committer ident: make user_ident_explicitly_given static t7502: factor out autoident prerequisite test-lib: allow negation of prerequisites
2012-11-29Merge branch 'jl/submodule-rm'Libravatar Junio C Hamano1-0/+15
Finishing touches to "git rm $submodule" that removes the working tree of a submodule. * jl/submodule-rm: Teach rm to remove submodules when given with a trailing '/'
2012-11-26Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: Fix typo in remote set-head usage Makefile: hide stderr of curl-config test
2012-11-26Fix typo in remote set-head usageLibravatar Antoine Pelisse1-1/+1
parenthesis are not matching in `builtin_remote_sethead_usage` as a square bracket is closing something never opened. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-25Merge branch 'jk/checkout-out-of-unborn' into maintLibravatar Junio C Hamano1-0/+3
* jk/checkout-out-of-unborn: checkout: print a message when switching unborn branches
2012-11-25Merge branch 'cn/config-missing-path' into maintLibravatar Junio C Hamano1-1/+2
* cn/config-missing-path: config: don't segfault when given --path with a missing value
2012-11-23Teach rm to remove submodules when given with a trailing '/'Libravatar Jens Lehmann1-0/+15
Doing a "git rm submod/" on a submodule results in an error: fatal: pathspec 'submod/' did not match any files This is really inconvenient as e.g. using TAB completion in a shell on a submodule automatically adds the trailing '/' when it completes the path of the submodule directory. The user has then to remove the '/' herself to make a "git rm" succeed. Doing a "git rm -r somedir/" is working fine, so there is no reason why that shouldn't work for submodules too. Teach git rm to not error out when a '/' is appended to the path of a submodule. Achieve this by chopping off trailing slashes from the path names given if they represent directories. Add tests to make sure that logic only applies to directories and not to files. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-21Merge branch 'jk/config-ignore-duplicates'Libravatar Junio C Hamano1-65/+43
Drop duplicate detection from "git-config --get"; this lets it better match the internal config callbacks, which clears up some corner cases with includes. * jk/config-ignore-duplicates: builtin/config.c: Fix a sparse warning git-config: use git_config_with_options git-config: do not complain about duplicate entries git-config: collect values instead of immediately printing git-config: fix regexp memory leaks on error conditions git-config: remove memory leak of key regexp t1300: test "git config --get-all" more thoroughly t1300: remove redundant test t1300: style updates
2012-11-20Merge branch 'jk/checkout-out-of-unborn'Libravatar Junio C Hamano1-0/+3
* jk/checkout-out-of-unborn: checkout: print a message when switching unborn branches
2012-11-20Merge branch 'cn/config-missing-path'Libravatar Junio C Hamano1-1/+2
"git config --path $key" segfaulted on "[section] key" (a boolean "true" spelled without "=", not "[section] key = true"). * cn/config-missing-path: config: don't segfault when given --path with a missing value
2012-11-20Merge branch 'mg/replace-resolve-delete'Libravatar Junio C Hamano1-6/+9
Be more user friendly to people using "git replace -d". * mg/replace-resolve-delete: replace: parse revision argument for -d
2012-11-20Merge branch 'kb/preload-index-more'Libravatar Junio C Hamano3-6/+15
Use preloadindex in more places, which has a nice speedup on systems with slow stat calls (and even on Linux). * kb/preload-index-more: update-index/diff-index: use core.preloadindex to improve performance
2012-11-18Merge branch 'rs/branch-del-symref' into maintLibravatar Junio C Hamano1-26/+49
A symbolic ref refs/heads/SYM was not correctly removed with "git branch -d SYM"; the command removed the ref pointed by SYM instead. * rs/branch-del-symref: branch: show targets of deleted symrefs, not sha1s branch: skip commit checks when deleting symref branches branch: delete symref branch, not its target branch: factor out delete_branch_config() branch: factor out check_branch_commit()
2012-11-18Merge branch 'nd/grep-true-path' into maintLibravatar Junio C Hamano1-13/+18
"git grep -e pattern <tree>" asked the attribute system to read "<tree>:.gitattributes" file in the working tree, which was nonsense. * nd/grep-true-path: grep: stop looking at random places for .gitattributes
2012-11-15config: don't segfault when given --path with a missing valueLibravatar Carlos Martín Nieto1-1/+2
When given a variable without a value, such as '[section] var' and asking git-config to treat it as a path, git_config_pathname returns an error and doesn't modify its output parameter. show_config assumes that the call is always successful and sets a variable to indicate that vptr should be freed. In case of an error however, trying to do this will cause the program to be killed, as it's pointing to memory in the stack. Detect the error and return immediately to avoid freeing or accessing the uninitialed memory in the stack. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-15ident: keep separate "explicit" flags for author and committerLibravatar Jeff King1-2/+2
We keep track of whether the user ident was given to us explicitly, or if we guessed at it from system parameters like username and hostname. However, we kept only a single variable. This covers the common cases (because the author and committer will usually come from the same explicit source), but can miss two cases: 1. GIT_COMMITTER_* is set explicitly, but we fallback for GIT_AUTHOR. We claim the ident is explicit, even though the author is not. 2. GIT_AUTHOR_* is set and we ask for author ident, but not committer ident. We will claim the ident is implicit, even though it is explicit. This patch uses two variables instead of one, updates both when we set the "fallback" values, and updates them individually when we read from the environment. Rather than keep user_ident_sufficiently_given as a compatibility wrapper, we update the only two callers to check the committer_ident, which matches their intent and what was happening already. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-15checkout: print a message when switching unborn branchesLibravatar Jeff King1-0/+3
When we switch to a new branch using checkout, we usually output a message indicating what happened. However, when we switch from an unborn branch to a new branch, we do not print anything, which may leave the user wondering what happened. The reason is that the unborn branch is a special case (see abe1998), and does not follow the usual switch_branches code path. Let's add a similar informational message to the special case to match the usual code path. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-15Merge branch 'jc/prettier-pretty-note'Libravatar Junio C Hamano1-2/+3
Emit the notes attached to the commit in "format-patch --notes" output after three-dashes. * jc/prettier-pretty-note: format-patch: add a blank line between notes and diffstat Doc User-Manual: Patch cover letter, three dashes, and --notes Doc format-patch: clarify --notes use case Doc notes: Include the format-patch --notes option Doc SubmittingPatches: Mention --notes option after "cover letter" Documentation: decribe format-patch --notes format-patch --notes: show notes after three-dashes format-patch: append --signature after notes pretty_print_commit(): do not append notes message pretty: prepare notes message at a centralized place format_note(): simplify API pretty: remove reencode_commit_message()
2012-11-15Merge branch 'jc/same-encoding'Libravatar Junio C Hamano1-1/+2
Various codepaths checked if two encoding names are the same using ad-hoc code and some of them ended up asking iconv() to convert between "utf8" and "UTF-8". The former is not a valid way to spell the encoding name, but often people use it by mistake, and we equated them in some but not all codepaths. Introduce a new helper function to make these codepaths consistent. * jc/same-encoding: reencode_string(): introduce and use same_encoding() Conflicts: builtin/mailinfo.c
2012-11-15Merge branch 'jh/symbolic-ref-d'Libravatar Junio C Hamano1-10/+23
Add "symbolic-ref -d SYM" to delete a symbolic ref SYM. It is already possible to remove a symbolic ref with "update-ref -d --no-deref", but it may be a good addition for completeness. * jh/symbolic-ref-d: git symbolic-ref --delete $symref
2012-11-13replace: parse revision argument for -dLibravatar Michael J Gruber1-6/+9
'git replace' parses the revision arguments when it creates replacements (so that a sha1 can be abbreviated, e.g.) but not when deleting replacements. Make it parse the argument to 'replace -d' in the same way. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Jeff King <peff@peff.net>
2012-11-09Merge branch 'nd/builtin-to-libgit'Libravatar Jeff King5-1448/+6
Code cleanups so that libgit.a does not depend on anything in the builtin/ directory. * nd/builtin-to-libgit: fetch-pack: move core code to libgit.a fetch-pack: remove global (static) configuration variable "args" send-pack: move core code to libgit.a Move setup_diff_pager to libgit.a Move print_commit_list to libgit.a Move estimate_bisect_steps to libgit.a Move try_merge_command and checkout_fast_forward to libgit.a
2012-11-04reencode_string(): introduce and use same_encoding()Libravatar Junio C Hamano1-1/+1
Callers of reencode_string() that re-encodes a string from one encoding to another all used ad-hoc way to bypass the case where the input and the output encodings are the same. Some did strcmp(), some did strcasecmp(), yet some others when converting to UTF-8 used is_encoding_utf8(). Introduce same_encoding() helper function to make these callers use the same logic. Notably, is_encoding_utf8() has a work-around for common misconfiguration to use "utf8" to name UTF-8 encoding, which does not match "UTF-8" hence strcasecmp() would not consider the same. Make use of it in this helper function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-02update-index/diff-index: use core.preloadindex to improve performanceLibravatar Karsten Blees3-6/+15
'update-index --refresh' and 'diff-index' (without --cached) don't honor the core.preloadindex setting yet. Porcelain commands using these (such as git [svn] rebase) suffer from this, especially on Windows. Use read_cache_preload to improve performance. Additionally, in builtin/diff.c, don't preload index status if we don't access the working copy (--cached). Results with msysgit on WebKit repo (2GB in 200k files): | update-index | diff-index | rebase ----------------+--------------+------------+--------- msysgit-v1.8.0 | 9.157s | 10.536s | 42.791s + preloadindex | 9.157s | 10.536s | 28.725s + this patch | 2.329s | 2.752s | 15.152s + fscache [1] | 0.731s | 1.171s | 8.877s [1] https://github.com/kblees/git/tree/kb/fscache-v3 Thanks-to: Albert Krawczyk <pro-logic@optusnet.com.au> Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Jeff King <peff@peff.net>
2012-10-29Merge branch 'rs/branch-del-symref'Libravatar Jeff King1-26/+49
A symbolic ref refs/heads/SYM was not correctly removed with "git branch -d SYM"; the command removed the ref pointed by SYM instead. * rs/branch-del-symref: branch: show targets of deleted symrefs, not sha1s branch: skip commit checks when deleting symref branches branch: delete symref branch, not its target branch: factor out delete_branch_config() branch: factor out check_branch_commit()
2012-10-29Merge branch 'nd/status-long'Libravatar Jeff King1-6/+23
Allow an earlier "--short" option on the command line to be countermanded with the "--long" option for "git status" and "git commit". * nd/status-long: status: add --long output format option
2012-10-29Merge branch 'nd/grep-true-path'Libravatar Jeff King1-13/+18
"git grep -e pattern <tree>" asked the attribute system to read "<tree>:.gitattributes" file in the working tree, which was nonsense. * nd/grep-true-path: grep: stop looking at random places for .gitattributes
2012-10-29Merge branch 'jc/grep-pcre-loose-ends'Libravatar Jeff King2-125/+16
"git log -F -E --grep='<ere>'" failed to use the given <ere> pattern as extended regular expression, and instead looked for the string literally. The early part of this series is a fix for it; the latter part teaches log to respect the grep.* configuration. * jc/grep-pcre-loose-ends: log: honor grep.* configuration log --grep: accept --basic-regexp and --perl-regexp log --grep: use the same helper to set -E/-F options as "git grep" revisions: initialize revs->grep_filter using grep_init() grep: move pattern-type bits support to top-level grep.[ch] grep: move the configuration parsing logic to grep.[ch] builtin/grep.c: make configuration callback more reusable