AgeCommit message (Collapse)Author
2016-09-26sha1_array: let callbacks interrupt iterationJeff King
The callbacks for iterating a sha1_array must have a void return. This is unlike our usual for_each semantics, where a callback may interrupt iteration and have its value propagated. Let's switch it to the usual form, which will enable its use in more places (e.g., where we are replacing an existing iteration with a different data structure). Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_short_sha1: mark ambiguity error for translationJeff King
This is a human-readable message, and there's no reason it should not be translated. While we're at it, let's drop the period from the end, which is not our usual style. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_short_sha1: NUL-terminate hex prefixJeff King
We store the hex prefix in a 40-byte buffer with the prefix itself followed by 40-minus-len "x" characters. These x's serve no purpose, and the lack of NUL termination makes the prefix string annoying to use. Let's just terminate it. Note that this is in contrast to the binary prefix, which _must_ be zero-padded, because we look at the whole thing during a binary search to find the first potential match in each pack index. The loose-object hex search cannot use the same trick because it has to do a linear walk through the unsorted results of readdir() (and even if it could, you'd want zeroes instead of x's). Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_short_sha1: refactor init of disambiguation codeJeff King
The disambiguation machinery has two callers: get_short_sha1 and for_each_abbrev. Both need to repeat much of the same setup: declaring buffers, sanity-checking lengths, preparing the prefixes, etc. Let's pull that into a single init function so we can avoid repeating ourselves. Pulling the buffers into the "struct disambiguate_state" isn't strictly necessary, but it does make things simpler for the callers, who no longer have to worry about sizing them correctly (i.e., it's an implicit requirement that the caller provide 20- and 40-byte buffers). And while we're touching this code, we can convert any magic-number sizes to the more modern GIT_SHA1_* constants. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_short_sha1: parse tags when looking for treeishJeff King
The treeish disambiguation function tries to peel tags, but it does so by calling: deref_tag(lookup_object(sha1), ...); This will only work if we have previously looked at the tag and created a "struct tag" for it. Since parsing revision arguments typically happens before anything else, this is usually not the case, and we would fail to peel the tag (we are lucky that deref_tag() gracefully handles the NULL and does not segfault). Instead, we can use parse_object(). Note that this is the same fix done by 94d75d1 (get_short_sha1(): correctly disambiguate type-limited abbreviation, 2013-07-01), but that commit fixed only the committish disambiguator, and left the bug in the treeish one. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_sha1: propagate flags to child functionsJeff King
The get_sha1() function is actually implementation by many sub-functions, but we do not always pass our flags around to all of those functions. As a result, we may forget that our caller asked us to resolve with GET_SHA1_QUIETLY and output messages. The two triggerable cases are: 1. Resolving treeish:path will resolve the "treeish" portion using GET_SHA1_TREEISH, dropping all other flags. 2. The peel_onion() function did not take flags at all but recurses to get_sha1_1(), which does. The solution for both is to bitwise-OR their new flags with the existing ones (after dropping any mutually exclusive disambiguation flags). This bug can trigger with "git rev-parse --quiet", which asks for quiet resolution. But it can also happen in a more vanilla code path when we do a follow-up ONLY_TO_DIE invocation of get_sha1(), and that's what the tests check. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_sha1: avoid repeating ourselves via ONLY_TO_DIEJeff King
When the revision code cannot parse an argument like "HEAD:foo", it will call maybe_die_on_misspelt_object_name(), which re-runs get_sha1() with an extra ONLY_TO_DIE flag. We then spend more effort to generate a better error message. Unfortunately, a side effect is that our second call may repeat the same error messages from the original get_sha1() call. You can see this with: $ git show 0017 error: short SHA1 0017 is ambiguous. error: short SHA1 0017 is ambiguous. fatal: ambiguous argument '0017': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' where the second "error:" line comes from the ONLY_TO_DIE call. To fix this, we can make ONLY_TO_DIE imply QUIETLY. This is a little odd, because the whole point of ONLY_TO_DIE is to output error messages. But what we want to do is tell the rest of the get_sha1() code (particularly get_sha1_1()) that the _regular_ messages should be quiet, but the only-to-die ones should not. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-26get_sha1: detect buggy calls with multiple disambiguatorsJeff King
The get_sha1() family of functions takes a flags field, but some of the flags are mutually exclusive. In particular, we can only handle one disambiguating function, and the flags quietly override each other. Let's instead detect these as programming bugs. Technically some of the flags are supersets of the others, so treating COMMITTISH|TREEISH as just COMMITTISH is not wrong, but it's a good sign the caller is confused. And certainly asking for BLOB|TREE does not work. We can do the check easily with some bit-twiddling, and as a bonus, the bit-mask of disambiguators will come in handy in a future patch. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2016-09-21Fourth batch for 2.11Junio C Hamano
Signed-off-by: Junio C Hamano <>
2016-09-21Merge branch 'jk/reduce-gc-aggressive-depth'Junio C Hamano
"git gc --aggressive" used to limit the delta-chain length to 250, which is way too deep for gaining additional space savings and is detrimental for runtime performance. The limit has been reduced to 50. * jk/reduce-gc-aggressive-depth: gc: default aggressive depth to 50
2016-09-21Merge branch 'jk/rebase-i-drop-ident-check'Junio C Hamano
Even when "git pull --rebase=preserve" (and the underlying "git rebase --preserve") can complete without creating any new commit (i.e. fast-forwards), it still insisted on having a usable ident information (read: is set correctly), which was less than nice. As the underlying commands used inside "git rebase" would fail with a more meaningful error message and advice text when the bogus ident matters, this extra check was removed. * jk/rebase-i-drop-ident-check: rebase-interactive: drop early check for valid ident
2016-09-21Merge branch 'va/i18n'Junio C Hamano
More i18n. * va/i18n: i18n: update-index: mark warnings for translation i18n: show-branch: mark plural strings for translation i18n: show-branch: mark error messages for translation i18n: receive-pack: mark messages for translation notes: spell first word of error messages in lowercase i18n: notes: mark error messages for translation i18n: merge-recursive: mark verbose message for translation i18n: merge-recursive: mark error messages for translation i18n: config: mark error message for translation i18n: branch: mark option description for translation i18n: blame: mark error messages for translation
2016-09-21Merge branch 'jt/format-patch-base-info-above-sig'Junio C Hamano
"git format-patch --base=..." feature that was recently added showed the base commit information after "-- " e-mail signature line, which turned out to be inconvenient. The base information has been moved above the signature line. * jt/format-patch-base-info-above-sig: format-patch: show base info before email signature
2016-09-21Merge branch 'ks/perf-build-with-autoconf'Junio C Hamano
Performance tests done via "t/perf" did not use the same set of build configuration if the user relied on autoconf generated configuration. * ks/perf-build-with-autoconf: t/perf/run: copy config.mak.autogen & friends to build area
2016-09-21Merge branch 'mr/vcs-svn-printf-ulong'Junio C Hamano
Code cleanup. * mr/vcs-svn-printf-ulong: vcs-svn/fast_export: fix timestamp fmt specifiers
2016-09-21Merge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context'Junio C Hamano
"git diff -W" output needs to extend the context backward to include the header line of the current function and also forward to include the body of the entire current function up to the header line of the next one. This process may have to merge to adjacent hunks, but the code forgot to do so in some cases. * rs/xdiff-merge-overlapping-hunks-for-W-context: xdiff: fix merging of hunks with -W context and -u context
2016-09-21Merge branch 'rs/unpack-trees-reduce-file-scope-global'Junio C Hamano
Code cleanup. * rs/unpack-trees-reduce-file-scope-global: unpack-trees: pass checkout state explicitly to check_updates()
2016-09-21Merge branch 'rs/strbuf-remove-fix'Junio C Hamano
Code cleanup. * rs/strbuf-remove-fix: strbuf: use valid pointer in strbuf_remove()
2016-09-21Merge branch 'rs/pack-sort-with-llist-mergesort'Junio C Hamano
Code cleanup. * rs/pack-sort-with-llist-mergesort: sha1_file: use llist_mergesort() for sorting packs
2016-09-21Merge branch 'rs/checkout-some-states-are-const'Junio C Hamano
Code cleanup. * rs/checkout-some-states-are-const: checkout: constify parameters of checkout_stage() and checkout_merged()
2016-09-21Merge branch 'jk/setup-sequence-update'Junio C Hamano
There were numerous corner cases in which the configuration files are read and used or not read at all depending on the directory a Git command was run, leading to inconsistent behaviour. The code to set-up repository access at the beginning of a Git process has been updated to fix them. * jk/setup-sequence-update: t1007: factor out repeated setup init: reset cached config when entering new repo init: expand comments explaining config trickery config: only read .git/config from configured repos test-config: setup git directory t1302: use "git -C" pager: handle early config pager: use callbacks instead of configset pager: make pager_program a file-local static pager: stop loading git_default_config() pager: remove obsolete comment diff: always try to set up the repository diff: handle --no-index prefixes consistently diff: skip implicit no-index check when given --no-index patch-id: use RUN_SETUP_GENTLY hash-object: always try to set up the git repository
2016-09-21Merge branch 'ew/http-do-not-forget-to-call-curl-multi-remove-handle'Junio C Hamano
The http transport (with curl-multi option, which is the default these days) failed to remove curl-easy handle from a curlm session, which led to unnecessary API failures. * ew/http-do-not-forget-to-call-curl-multi-remove-handle: http: always remove curl easy from curlm session on release http: consolidate #ifdefs for curl_multi_remove_handle http: warn on curl_multi_add_handle failures
2016-09-21Merge branch 'bw/pathspec-remove-unused-extern-decl'Junio C Hamano
Code cleanup. * bw/pathspec-remove-unused-extern-decl: pathspec: remove unnecessary function prototypes
2016-09-21Merge branch 'ks/pack-objects-bitmap'Junio C Hamano
Some codepaths in "git pack-objects" were not ready to use an existing pack bitmap; now they are and as the result they have become faster. * ks/pack-objects-bitmap: pack-objects: use reachability bitmap index when generating non-stdout pack pack-objects: respect --local/--honor-pack-keep/--incremental when bitmap is in use
2016-09-21Merge branch 'jk/patch-ids-no-merges'Junio C Hamano
"git log --cherry-pick" used to include merge commits as candidates to be matched up with other commits, resulting a lot of wasted time. The patch-id generation logic has been updated to ignore merges to avoid the wastage. * jk/patch-ids-no-merges: patch-ids: refuse to compute patch-id for merge commit patch-ids: turn off rename detection
2016-09-21Merge branch 'jk/delta-base-cache'Junio C Hamano
Recently we updated the code to manage the in-core cache that holds objects that have recently been used to reconstitute other objects that are stored as deltas against them, but the update used an incorrect API function to manage the list of these objects. This has been fixed. * jk/delta-base-cache: add_delta_base_cache: use list_for_each_safe
2016-09-21Merge branch 'et/add-chmod-x'Junio C Hamano
"git add --chmod=+x" added recently lacked documentation, which has been corrected. * et/add-chmod-x: add: document the chmod option
2016-09-21Merge branch 'js/cat-file-filters'Junio C Hamano
Even though "git hash-objects", which is a tool to take an on-filesystem data stream and put it into the Git object store, allowed to perform the "outside-world-to-Git" conversions (e.g. end-of-line conversions and application of the clean-filter), and it had the feature on by default from very early days, its reverse operation "git cat-file", which takes an object from the Git object store and externalize for the consumption by the outside world, lacked an equivalent mechanism to run the "Git-to-outside-world" conversion. The command learned the "--filters" option to do so. * js/cat-file-filters: cat-file: support --textconv/--filters in batch mode cat-file --textconv/--filters: allow specifying the path separately cat-file: introduce the --filters option cat-file: fix a grammo in the man page
2016-09-21Merge branch 'jt/accept-capability-advertisement-when-fetching-from-void'Junio C Hamano
JGit can show a fake ref "capabilities^{}" to "git fetch" when it does not advertise any refs, but "git fetch" was not prepared to see such an advertisement. When the other side disconnects without giving any ref advertisement, we used to say "there may not be a repository at that URL", but we may have seen other advertisement like "shallow" and ".have" in which case we definitely know that a repository is there. The code to detect this case has also been updated. * jt/accept-capability-advertisement-when-fetching-from-void: connect: advertized capability is not a ref connect: tighten check for unexpected early hang up tests: move test_lazy_prereq JGIT to
2016-09-19Sync with maintJunio C Hamano
* maint: Start preparing for 2.10.1
2016-09-19Start preparing for 2.10.1Junio C Hamano
Signed-off-by: Junio C Hamano <>
2016-09-19Merge branch 'sb/diff-cleanup' into maintJunio C Hamano
Code cleanup. * sb/diff-cleanup: diff: remove dead code diff: omit found pointer from emit_callback diff.c: use diff_options directly
2016-09-19Merge branch 'ah/misc-message-fixes' into maintJunio C Hamano
Message cleanup. * ah/misc-message-fixes: unpack-trees: do not capitalize "working" git-merge-octopus: do not capitalize "octopus" git-rebase--interactive: fix English grammar cat-file: put spaces around pipes in usage string am: put spaces around pipe in usage string
2016-09-19Merge branch 'sb/transport-report-missing-submodule-on-stderr' into maintJunio C Hamano
Message cleanup. * sb/transport-report-missing-submodule-on-stderr: transport: report missing submodule pushes consistently on stderr
2016-09-19Merge branch 'sb/xdiff-remove-unused-static-decl' into maintJunio C Hamano
Code cleanup. * sb/xdiff-remove-unused-static-decl: xdiff: remove unneeded declarations
2016-09-19Merge branch 'js/t9903-chaining' into maintJunio C Hamano
Test fix. * js/t9903-chaining: t9903: fix broken && chain
2016-09-19Merge branch 'rs/hex2chr' into maintJunio C Hamano
Code cleanup. * rs/hex2chr: introduce hex2chr() for converting two hexadecimal digits to a character
2016-09-19Merge branch 'rs/compat-strdup' into maintJunio C Hamano
Code cleanup. * rs/compat-strdup: compat: move strdup(3) replacement to its own file
2016-09-19Merge branch 'jk/squelch-false-warning-from-gcc-o3' into maintJunio C Hamano
Compilation fix. * jk/squelch-false-warning-from-gcc-o3: color_parse_mem: initialize "struct color" temporary error_errno: use constant return similar to error()
2016-09-19Merge branch 'ep/use-git-trace-curl-in-tests' into maintJunio C Hamano
Update a few tests that used to use GIT_CURL_VERBOSE to use the newer GIT_TRACE_CURL. * ep/use-git-trace-curl-in-tests: use the GIT_TRACE_CURL environment var use the GIT_TRACE_CURL environment var preserve GIT_TRACE_CURL from the environment use the GIT_TRACE_CURL environment var
2016-09-19Merge branch 'js/t6026-clean-up' into maintJunio C Hamano
A test spawned a short-lived background process, which sometimes prevented the test directory from getting removed at the end of the script on some platforms. * js/t6026-clean-up: t6026-merge-attr: clean up background process at end of test case
2016-09-19Merge branch 'jc/forbid-symbolic-ref-d-HEAD' into maintJunio C Hamano
"git symbolic-ref -d HEAD" happily removes the symbolic ref, but the resulting repository becomes an invalid one. Teach the command to forbid removal of HEAD. * jc/forbid-symbolic-ref-d-HEAD: symbolic-ref -d: do not allow removal of HEAD
2016-09-19Merge branch 'jc/submodule-anchor-git-dir' into maintJunio C Hamano
Having a submodule whose ".git" repository is somehow corrupt caused a few commands that recurse into submodules loop forever. * jc/submodule-anchor-git-dir: submodule: avoid auto-discovery in prepare_submodule_repo_env()
2016-09-19Merge branch 'jk/test-lib-drop-pid-from-results' into maintJunio C Hamano
The test framework left the number of tests and success/failure count in the t/test-results directory, keyed by the name of the test script plus the process ID. The latter however turned out not to serve any useful purpose. The process ID part of the filename has been removed. * jk/test-lib-drop-pid-from-results: test-lib: drop PID from test-results/*.count
2016-09-19Merge branch 'bh/diff-highlight-graph' into maintJunio C Hamano
"diff-highlight" script (in contrib/) learned to work better with "git log -p --graph" output. * bh/diff-highlight-graph: diff-highlight: avoid highlighting combined diffs diff-highlight: add multi-byte tests diff-highlight: ignore test cruft diff-highlight: add support for --graph output diff-highlight: add failing test for handling --graph output diff-highlight: add some tests
2016-09-19Merge branch 'po/range-doc' into maintJunio C Hamano
Clarify various ways to specify the "revision ranges" in the documentation. * po/range-doc: doc: revisions: sort examples and fix alignment of the unchanged doc: revisions: show revision expansion in examples doc: revisions - clarify reachability examples doc: revisions - define `reachable` doc: gitrevisions - clarify 'latter case' is revision walk doc: gitrevisions - use 'reachable' in page description doc: revisions: single vs multi-parent notation comparison doc: revisions: extra clarification of <rev>^! notation effects doc: revisions: give headings for the two and three dot notations doc: show the actual left, right, and boundary marks doc: revisions - name the left and right sides doc: use 'symmetric difference' consistently
2016-09-19Third batch for 2.11Junio C Hamano
This round they are somewhat bigger topics. Signed-off-by: Junio C Hamano <>
2016-09-19Merge branch 'bc/object-id'Junio C Hamano
The "unsigned char sha1[20]" to "struct object_id" conversion continues. Notable changes in this round includes that ce->sha1, i.e. the object name recorded in the cache_entry, turns into an object_id. It had merge conflicts with a few topics in flight (Christian's "apply.c split", Dscho's "cat-file --filters" and Jeff Hostetler's "status --porcelain-v2"). Extra sets of eyes double-checking for mismerges are highly appreciated. * bc/object-id: builtin/reset: convert to use struct object_id builtin/commit-tree: convert to struct object_id builtin/am: convert to struct object_id refs: add an update_ref_oid function. sha1_name: convert get_sha1_mb to struct object_id builtin/update-index: convert file to struct object_id notes: convert init_notes to use struct object_id builtin/rm: convert to use struct object_id builtin/blame: convert file to use struct object_id Convert read_mmblob to take struct object_id. notes-merge: convert struct notes_merge_pair to struct object_id builtin/checkout: convert some static functions to struct object_id streaming: make stream_blob_to_fd take struct object_id builtin: convert textconv_object to use struct object_id builtin/cat-file: convert some static functions to struct object_id builtin/cat-file: convert struct expand_data to use struct object_id builtin/log: convert some static functions to use struct object_id builtin/blame: convert struct origin to use struct object_id builtin/apply: convert static functions to struct object_id cache: convert struct cache_entry to use struct object_id
2016-09-19Merge branch 'mh/ref-store'Junio C Hamano
The ref-store abstraction was introduced to the refs API so that we can plug in different backends to store references. * mh/ref-store: (38 commits) refs: implement iteration over only per-worktree refs refs: make lock generic refs: add method to rename refs refs: add methods to init refs db refs: make delete_refs() virtual refs: add method for initial ref transaction commit refs: add methods for reflog refs: add method iterator_begin files_ref_iterator_begin(): take a ref_store argument split_symref_update(): add a files_ref_store argument lock_ref_sha1_basic(): add a files_ref_store argument lock_ref_for_update(): add a files_ref_store argument commit_ref_update(): add a files_ref_store argument lock_raw_ref(): add a files_ref_store argument repack_without_refs(): add a files_ref_store argument refs: make peel_ref() virtual refs: make create_symref() virtual refs: make pack_refs() virtual refs: make verify_refname_available() virtual refs: make read_raw_ref() virtual ...
2016-09-19Merge branch 'cc/apply-am'Junio C Hamano
"git am" has been taught to make an internal call to "git apply"'s innards without spawning the latter as a separate process. * cc/apply-am: (41 commits) builtin/am: use apply API in run_apply() apply: learn to use a different index file apply: pass apply state to build_fake_ancestor() apply: refactor `git apply` option parsing apply: change error_routine when silent usage: add get_error_routine() and get_warn_routine() usage: add set_warn_routine() apply: don't print on stdout in verbosity_silent mode apply: make it possible to silently apply apply: use error_errno() where possible apply: make some parsing functions static again apply: move libified code from builtin/apply.c to apply.{c,h} apply: rename and move opt constants to apply.h builtin/apply: rename option parsing functions builtin/apply: make create_one_file() return -1 on error builtin/apply: make try_create_file() return -1 on error builtin/apply: make write_out_results() return -1 on error builtin/apply: make write_out_one_result() return -1 on error builtin/apply: make create_file() return -1 on error builtin/apply: make add_index_file() return -1 on error ...