summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)Author
2016-06-06Merge branch 'ar/diff-args-osx-precompose' into maintJunio C Hamano
Many commands normalize command line arguments from NFD to NFC variant of UTF-8 on OSX, but commands in the "diff" family did not, causing "git diff $path" to complain that no such path is known to Git. They have been taught to do the normalization. * ar/diff-args-osx-precompose: diff: run arguments through precompose_argv
2016-05-31Merge branch 'js/name-rev-use-oldest-ref' into maintJunio C Hamano
"git describe --contains" often made a hard-to-justify choice of tag to give name to a given commit, because it tried to come up with a name with smallest number of hops from a tag, causing an old commit whose close descendant that is recently tagged were not described with respect to an old tag but with a newer tag. It did not help that its computation of "hop" count was further tweaked to penalize being on a side branch of a merge. The logic has been updated to favor using the tag with the oldest tagger date, which is a lot easier to explain to the end users: "We describe a commit in terms of the (chronologically) oldest tag that contains the commit." * js/name-rev-use-oldest-ref: name-rev: include taggerdate in considering the best name
2016-05-26Merge branch 'lp/typofixes' into maintJunio C Hamano
Typofixes. * lp/typofixes: typofix: assorted typofixes in comments, documentation and messages
2016-05-26Merge branch 'va/i18n-misc-updates' into maintJunio C Hamano
Mark several messages for translation. * va/i18n-misc-updates: i18n: unpack-trees: avoid substituting only a verb in sentences i18n: builtin/pull.c: split strings marked for translation i18n: builtin/pull.c: mark placeholders for translation i18n: git-parse-remote.sh: mark strings for translation i18n: branch: move comment for translators i18n: branch: unmark string for translation i18n: builtin/rm.c: remove a comma ',' from string i18n: unpack-trees: mark strings for translation i18n: builtin/branch.c: mark option for translation i18n: index-pack: use plural string instead of normal one
2016-05-26Merge branch 'va/i18n-remote-comment-to-align' into maintJunio C Hamano
Message fix. * va/i18n-remote-comment-to-align: i18n: remote: add comment for translators
2016-05-18Merge branch 'sb/misc-cleanups' into HEADJunio C Hamano
* sb/misc-cleanups: submodule-config: don't shadow `cache` config.c: drop local variable credential-cache, send_request: close fd when done bundle: don't leak an fd in case of early return abbrev_sha1_in_line: don't leak memory notes: don't leak memory in git_config_get_notes_strategy
2016-05-18Merge branch 'ew/doc-split-pack-disables-bitmap' into HEADJunio C Hamano
Doc update. * ew/doc-split-pack-disables-bitmap: pack-objects: warn on split packs disabling bitmaps
2016-05-18Merge branch 'sb/mv-submodule-fix' into HEADJunio C Hamano
"git mv old new" did not adjust the path for a submodule that lives as a subdirectory inside old/ directory correctly. * sb/mv-submodule-fix: mv: allow moving nested submodules
2016-05-13diff: run arguments through precompose_argvAlexander Rinass
When running diff commands, a pathspec containing decomposed unicode code points is not converted to precomposed unicode form under Mac OS X, but we normalize the paths in the index and the history to precomposed form on that platform. As a result, the pathspec would not match and no diff is shown. Unlike many builtin commands, the "diff" family of commands do not use parse_options(), which is how other builtin commands indirectly call precompose_argv() to normalize argv[] into precomposed form on Mac OSX. Teach these commands to call precompose_argv() themselves. Note that precomopose_argv() normalizes not just paths but all command line arguments, so things like "git diff -G $string" when $string has the decomposed form would first be normalized into the precomposed form and would stop hitting the same string in the decomposed form in the diff output with this change. It is not a problem per-se, as "log" family of commands already use parse_options() and call precompose_argv()--we can think of this change as making the "diff" family of commands behave in a similar way as the commands in the "log" family. Signed-off-by: Alexander Rinass <alex@fournova.com> Helped-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-09i18n: remote: add comment for translatorsVasco Almeida
Add comment drawing translator attention in order to align "Push URL:" and "Fetch URL:" fields translation of git remote show output. Aligning both fields makes the output more appealing and easier to grasp. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-06Merge branch 'js/replace-edit-use-editor-configuration' into maintJunio C Hamano
"git replace -e" did not honour "core.editor" configuration. * js/replace-edit-use-editor-configuration: replace --edit: respect core.editor
2016-05-06Merge branch 'cc/apply' into maintJunio C Hamano
Minor code clean-up. * cc/apply: builtin/apply: free patch when parse_chunk() fails builtin/apply: handle parse_binary() failure apply: remove unused call to free() in gitdiff_{old,new}name() builtin/apply: get rid of useless 'name' variable
2016-05-06typofix: assorted typofixes in comments, documentation and messagesLi Peng
Many instances of duplicate words (e.g. "the the path") and a few typoes are fixed, originally in multiple patches. wildmatch: fix duplicate words of "the" t: fix duplicate words of "output" transport-helper: fix duplicate words of "read" Git.pm: fix duplicate words of "return" path: fix duplicate words of "look" pack-protocol.txt: fix duplicate words of "the" precompose-utf8: fix typo of "sequences" split-index: fix typo worktree.c: fix typo remote-ext: fix typo utf8: fix duplicate words of "the" git-cvsserver: fix duplicate words Signed-off-by: Li Peng <lip@dtdream.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-02Merge branch 'ad/commit-have-m-option' into maintJunio C Hamano
"git commit" misbehaved in a few minor ways when an empty message is given via -m '', all of which has been corrected. * ad/commit-have-m-option: commit: do not ignore an empty message given by -m '' commit: --amend -m '' silently fails to wipe message
2016-05-02Merge branch 'sb/submodule-helper-clone-regression-fix' into maintJunio C Hamano
A partial rewrite of "git submodule" in the 2.7 timeframe changed the way the gitdir: pointer in the submodules point at the real repository location to use absolute paths by accident. This has been corrected. * sb/submodule-helper-clone-regression-fix: submodule--helper, module_clone: catch fprintf failure submodule--helper: do not borrow absolute_path() result for too long submodule--helper, module_clone: always operate on absolute paths submodule--helper clone: create the submodule path just once submodule--helper: fix potential NULL-dereference recursive submodules: test for relative paths
2016-05-02Merge branch 'jk/branch-shortening-funny-symrefs' into maintJunio C Hamano
A change back in version 2.7 to "git branch" broke display of a symbolic ref in a non-standard place in the refs/ hierarchy (we expect symbolic refs to appear in refs/remotes/*/HEAD to point at the primary branch the remote has, and as .git/HEAD to point at the branch we locally checked out). * jk/branch-shortening-funny-symrefs: branch: fix shortening of non-remote symrefs
2016-05-02Merge branch 'ky/branch-m-worktree' into maintJunio C Hamano
When "git worktree" feature is in use, "git branch -m" renamed a branch that is checked out in another worktree without adjusting the HEAD symbolic ref for the worktree. * ky/branch-m-worktree: set_worktree_head_symref(): fix error message branch -m: update all per-worktree HEADs refs: add a new function set_worktree_head_symref
2016-05-02Merge branch 'ky/branch-d-worktree' into maintJunio C Hamano
When "git worktree" feature is in use, "git branch -d" allowed deletion of a branch that is checked out in another worktree * ky/branch-d-worktree: branch -d: refuse deleting a branch which is currently checked out
2016-05-02Merge branch 'jk/check-repository-format' into maintJunio C Hamano
The repository set-up sequence has been streamlined (the biggest change is that there is no longer git_config_early()), so that we do not attempt to look into refs/* when we know we do not have a Git repository. * jk/check-repository-format: verify_repository_format: mark messages for translation setup: drop repository_format_version global setup: unify repository version callbacks init: use setup.c's repo version verification setup: refactor repo format reading and verification config: drop git_config_early check_repository_format_gently: stop using git_config_early lazily load core.sharedrepository wrap shared_repository global in get/set accessors setup: document check_repository_format()
2016-04-29Merge branch 'tb/blame-force-read-cache-to-workaround-safe-crlf' into maintJunio C Hamano
When running "git blame $path" with unnormalized data in the index for the path, the data in the working tree was blamed, even though "git add" would not have changed what is already in the index, due to "safe crlf" that disables the line-end conversion. It has been corrected. * tb/blame-force-read-cache-to-workaround-safe-crlf: correct blame for files commited with CRLF
2016-04-29Merge branch 'sk/send-pack-all-fix' into maintJunio C Hamano
"git send-pack --all <there>" was broken when its command line option parsing was written in the 2.6 timeframe. * sk/send-pack-all-fix: git-send-pack: fix --all option when used with directory
2016-04-28pack-objects: warn on split packs disabling bitmapsEric Wong
It can be tempting for a server admin to want a stable set of long-lived packs for dumb clients; but also want to enable bitmaps to serve smart clients more quickly. Unfortunately, such a configuration is impossible; so at least warn users of this incompatibility since commit 21134714 (pack-objects: turn off bitmaps when we split packs, 2014-10-16). Tested the warning by inspecting the output of: make -C t t5310-pack-bitmaps.sh GIT_TEST_OPTS=-v Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-22name-rev: include taggerdate in considering the best nameJohannes Schindelin
We most likely want the oldest tag that contained the commit to be reported. So let's remember the taggerdate, and make it more important than anything else when choosing the best name for a given commit. Suggested by Linus Torvalds. Note that we need to update t9903 because it tested for the old behavior (which preferred the description "b1~1" over "tags/t2~1"). We might want to introduce a --heed-taggerdate option, and make the new behavior dependent on that, if it turns out that some scripts rely on the old name-rev method. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-20replace --edit: respect core.editorJohannes Schindelin
We simply need to read the config, is all. This fixes https://github.com/git-for-windows/git/issues/733 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-19i18n: builtin/pull.c: split strings marked for translationVasco Almeida
Split string "If you wish to set tracking information for this branch you can do so with:\n" to match occurring string in git-parse-remote.sh. In this case, the translator handles it only once. On the other hand, the translations of the string that were already made are mark as fuzzy and the translator needs to correct it herself. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-19i18n: builtin/pull.c: mark placeholders for translationVasco Almeida
Some translations might also translate "<remote>" and "<branch>". Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-19mv: allow moving nested submodulesStefan Beller
When directories are moved using `git mv` all files in the directory have been just moved, but no further action was taken on them. This was done by assigning the mode = WORKING_DIRECTORY to the files inside a moved directory. submodules however need to update their link to the git directory as well as updates to the .gitmodules file. By removing the condition of `mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for the required submodule actions, we perform these for submodules in a moved directory. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-15Merge branch 'jv/merge-nothing-into-void' into maintJunio C Hamano
"git merge FETCH_HEAD" dereferenced NULL pointer when merging nothing into an unborn history (which is arguably unusual usage, which perhaps was the reason why nobody noticed it). * jv/merge-nothing-into-void: merge: fix NULL pointer dereference when merging nothing into void
2016-04-15Merge branch 'ss/commit-squash-msg' into maintJunio C Hamano
When "git merge --squash" stopped due to conflict, the concluding "git commit" failed to read in the SQUASH_MSG that shows the log messages from all the squashed commits. * ss/commit-squash-msg: commit: do not lose SQUASH_MSG contents
2016-04-15Merge branch 'jk/startup-info' into maintJunio C Hamano
The startup_info data, which records if we are working inside a repository (among other things), are now uniformly available to Git subcommand implementations, and Git avoids attempting to touch references when we are not in a repository. * jk/startup-info: use setup_git_directory() in test-* programs grep: turn off gitlink detection for --no-index mailmap: do not resolve blobs in a non-repository remote: don't resolve HEAD in non-repository setup: set startup_info->have_repository more reliably setup: make startup_info available everywhere
2016-04-15Merge branch 'gf/fetch-pack-direct-object-fetch' into maintJunio C Hamano
Fetching of history by naming a commit object name directly didn't work across remote-curl transport. * gf/fetch-pack-direct-object-fetch: fetch-pack: update the documentation for "<refs>..." arguments fetch-pack: fix object_id of exact sha1
2016-04-15Merge branch 'jk/rev-parse-local-env-vars' into maintJunio C Hamano
The "--local-env-vars" and "--resolve-git-dir" options of "git rev-parse" failed to work outside a repository when the command's option parsing was rewritten in 1.8.5 era. * jk/rev-parse-local-env-vars: rev-parse: let some options run outside repository t1515: add tests for rev-parse out-of-repo helpers
2016-04-15Merge branch 'jk/config-get-urlmatch' into maintJunio C Hamano
"git config --get-urlmatch", unlike other variants of the "git config --get" family, did not signal error with its exit status when there was no matching configuration. * jk/config-get-urlmatch: Documentation/git-config: fix --get-all description Documentation/git-config: use bulleted list for exit codes config: fail if --get-urlmatch finds no value
2016-04-15Merge branch 'jc/index-pack' into maintJunio C Hamano
Code clean-up. * jc/index-pack: index-pack: add a helper function to derive .idx/.keep filename index-pack: correct --keep[=<msg>]
2016-04-13i18n: branch: move comment for translatorsVasco Almeida
Move and split comment for translators (marked by TRANSLATORS) to be immediately above the strings marked for translation. As a result, the comment can now be extracted by xgettext. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-13i18n: branch: unmark string for translationVasco Almeida
Unmark strings for translation for command help/hint. These strings can not be translated, just copied. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-12i18n: builtin/rm.c: remove a comma ',' from stringVasco Almeida
Remove a comma from string marked for translation. Make the string match the one in builtin/mv.c. Now translators have do handle this string only once. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-08i18n: builtin/branch.c: mark option for translationVasco Almeida
Mark description and parameter for option "set-upstream-to" for translation. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-08i18n: index-pack: use plural string instead of normal oneVasco Almeida
Git could output "completed with 1 local objects", but in this case using "object" instead of "objects" is the correct form. Use Q_() instead of _(). Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-07commit: do not ignore an empty message given by -m ''Jeff King
When f9568530 (builtin-commit: resurrect behavior for multiple -m options, 2007-11-11) converted a "char *message" to "struct strbuf message" to hold the messages given with the "-m" option, it incorrectly changed the checks "did we get a message with the -m option?" to "is message.len 0?". Later, we noticed one breakage from this change and corrected it with 25206778 (commit: don't start editor if empty message is given with -m, 2013-05-25). However, "we got a message with -m, even though an empty one, so we shouldn't be launching an editor" was not the only breakage. * "git commit --amend -m '' --allow-empty", even though it looks strange, is a valid request to amend the commit to have no message at all. Due to the misdetection of the presence of -m on the command line, we ended up keeping the log messsage from the original commit. * "git commit -m "$msg" -F file" should be rejected whether $msg is an empty string or not, but due to the same bug, was not rejected when $msg is empty. * "git -c template=file -m "$msg"" should ignore the template even when $msg is empty, but it didn't and instead used the contents from the template file. Correct these by checking have_option_m, which the earlier 25206778 introduced to fix the same bug. Reported-by: Adam Dinwoodie <adam@dinwoodie.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-05correct blame for files commited with CRLFTorsten Bögershausen
git blame reports lines as not "Not Committed Yet" when they have CRLF in the index, CRLF in the worktree and core.autocrlf is true. Since commit c4805393 (autocrlf: Make it work also for un-normalized repositories, 2010-05-12), files that have CRLF in the index are not normalized at commit when core.autocrl is set. Add a call to read_cache() early in fake_working_tree_commit(), before calling convert_to_git(). Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-05branch: fix shortening of non-remote symrefsJeff King
Commit aedcb7d (branch.c: use 'ref-filter' APIs, 2015-09-23) adjusted the symref-printing code to look like this: if (item->symref) { skip_prefix(item->symref, "refs/remotes/", &desc); strbuf_addf(&out, " -> %s", desc); } This has three bugs in it: 1. It always skips past "refs/remotes/", instead of skipping past the prefix associated with the branch we are showing (so commonly we see "refs/remotes/" for the refs/remotes/origin/HEAD symref, but the previous code would skip "refs/heads/" when showing a symref it found in refs/heads/. 2. If skip_prefix() does not match, it leaves "desc" untouched, and we show whatever happened to be in it (which is the refname from a call to skip_prefix() earlier in the function). 3. If we do match with skip_prefix(), we stomp on the "desc" variable, which is later passed to add_verbose_info(). We probably want to retain the original refname there (though it likely doesn't matter in practice, since after all, one points to the other). The fix to match the original code is fairly easy: record the prefix to strip based on item->kind, and use it here. However, since we already have a local variable named "prefix", let's give the two prefixes verbose names so we don't confuse them. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-04branch -m: update all per-worktree HEADsKazuki Yamaguchi
When renaming a branch, currently only the HEAD of current working tree is updated, but it must update HEADs of all working trees which point at the old branch. This is the current behavior, /path/to/wt's HEAD is not updated: % git worktree list /path/to 2c3c5f2 [master] /path/to/wt 2c3c5f2 [oldname] % git branch -m master master2 % git worktree list /path/to 2c3c5f2 [master2] /path/to/wt 2c3c5f2 [oldname] % git branch -m oldname newname % git worktree list /path/to 2c3c5f2 [master2] /path/to/wt 0000000 [oldname] This patch fixes this issue by updating all relevant worktree HEADs when renaming a branch. Signed-off-by: Kazuki Yamaguchi <k@rhe.jp> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-01submodule--helper, module_clone: catch fprintf failureStefan Beller
The return value of fprintf is unchecked, which may lead to unreported errors. Use fprintf_or_die to report the error to the user. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-01submodule--helper: do not borrow absolute_path() result for too longJunio C Hamano
absolute_path() is designed to allow its callers to take a brief peek of the result (typically, to be fed to functions like strbuf_add() and relative_path() as a parameter) without having to worry about freeing it, but the other side of the coin of that memory model is that the caller shouldn't rely too much on the result living forever--there may be a helper function the caller subsequently calls that makes its own call to absolute_path(), invalidating the earlier result. Use xstrdup() to make our own copy, and free(3) it when we are done. While at it, remove an unnecessary sm_gitdir_rel variable that was only used to as a parameter to call absolute_path() and never used again. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-01submodule--helper, module_clone: always operate on absolute pathsStefan Beller
When giving relative paths to `relative_path` to compute a relative path from one directory to another, this may fail in `relative_path`. Make sure both arguments to `relative_path` are always absolute. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-01notes: don't leak memory in git_config_get_notes_strategyStefan Beller
This function asks for the value of a configuration and after using the value does not have to retain ownership of it. git_config_get_string_const() however is a function to get a copy of the value, but we forget to free it before we return. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-01builtin/apply: free patch when parse_chunk() failsChristian Couder
When parse_chunk() fails it can return -1, for example when find_header() doesn't find a patch header. In this case it's better in apply_patch() to free the "struct patch" that we just allocated instead of leaking it. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-01builtin/apply: handle parse_binary() failureChristian Couder
In parse_binary() there is: forward = parse_binary_hunk(&buffer, &size, &status, &used); if (!forward && !status) /* there has to be one hunk (forward hunk) */ return error(_("unrecognized binary patch at line %d"), linenr-1); so parse_binary() can return -1, because that's what error() returns. Also parse_binary_hunk() sets "status" to -1 in case of error and parse_binary() does "if (status) return status;". In this case parse_chunk() should not add -1 to the patchsize it computes. It is better for future libification efforts to make it just return -1. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-31submodule--helper clone: create the submodule path just onceStefan Beller
We make sure that the parent directory of path exists (or create it otherwise) and then do the same for path + "/.git". That is equivalent to just making sure that the parent directory of path + "/.git" exists (or create it otherwise). Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>