summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-02-05Merge branch 'jk/diff-cc-stat-fixes'Libravatar Junio C Hamano8-30/+147
"git diff --color-moved --cc --stat -p" did not work well due to funny interaction between a bug in color-moved and the rest, which has been fixed. * jk/diff-cc-stat-fixes: combine-diff: treat --dirstat like --stat combine-diff: treat --summary like --stat combine-diff: treat --shortstat like --stat combine-diff: factor out stat-format mask diff: clear emitted_symbols flag after use t4006: resurrect commented-out tests
2019-02-05Merge branch 'bp/checkout-new-branch-optim'Libravatar Junio C Hamano2-0/+17
"git checkout -b <new> [HEAD]" to create a new branch from the current commit and check it out ought to be a no-op in the index and the working tree in normal cases, but there are corner cases that do require updates to the index and the working tree. Running it immediately after "git clone --no-checkout" is one of these cases that an earlier optimization kicked in incorrectly, which has been fixed. * bp/checkout-new-branch-optim: checkout: fix regression in checkout -b on intitial checkout checkout: add test demonstrating regression with checkout -b on initial commit
2019-02-05Merge branch 'ja/doc-style-fix'Libravatar Junio C Hamano14-94/+93
Doc typo/stylo fixes. * ja/doc-style-fix: doc: tidy asciidoc style
2019-02-05Merge branch 'ph/pack-objects-mutex-fix'Libravatar Junio C Hamano3-23/+19
"git pack-objects" incorrectly used uninitialized mutex, which has been corrected. * ph/pack-objects-mutex-fix: pack-objects: merge read_lock and lock in packing_data struct pack-objects: move read mutex to packing_data struct
2019-02-05Merge branch 'jk/attr-macro-fix'Libravatar Junio C Hamano2-15/+21
Asking "git check-attr" about a macro (e.g. "binary") on a specific path did not work correctly, even though "git check-attr -a" listed such a macro correctly. This has been corrected. * jk/attr-macro-fix: attr: do not mark queried macros as unset
2019-02-05Merge branch 'js/test-git-installed'Libravatar Junio C Hamano1-1/+1
Test fix for Windows. * js/test-git-installed: tests: explicitly use `test-tool.exe` on Windows
2019-02-05Merge branch 'js/abspath-part-inside-repo'Libravatar Junio C Hamano2-3/+10
On a case-insensitive filesystem, we failed to compare the part of the path that is above the worktree directory in an absolute pathname, which has been corrected. * js/abspath-part-inside-repo: abspath_part_inside_repo: respect core.ignoreCase
2019-02-05Merge branch 'jt/namespaced-ls-refs-fix'Libravatar Junio C Hamano2-1/+22
Fix namespace support in protocol v2. * jt/namespaced-ls-refs-fix: ls-refs: filter refs using namespace-stripped name
2019-02-05Merge branch 'ab/commit-graph-write-progress'Libravatar Junio C Hamano5-48/+106
The codepath to show progress meter while writing out commit-graph file has been improved. * ab/commit-graph-write-progress: commit-graph write: emit a percentage for all progress commit-graph write: add itermediate progress commit-graph write: remove empty line for readability commit-graph write: add more descriptive progress output commit-graph write: show progress for object search commit-graph write: more descriptive "writing out" output commit-graph write: add "Writing out" progress output commit-graph: don't call write_graph_chunk_extra_edges() unnecessarily commit-graph: rename "large edges" to "extra edges"
2019-02-05Merge branch 'ab/commit-graph-write-optim'Libravatar Junio C Hamano1-2/+4
The codepath to write out commit-graph has been optimized by following the usual pattern of visiting objects in in-pack order. * ab/commit-graph-write-optim: commit-graph write: use pack order when finding commits
2019-02-05Merge branch 'js/t6042-timing-fix'Libravatar Junio C Hamano1-2/+2
Test update. * js/t6042-timing-fix: t6042: work around speed optimization on Windows
2019-02-05Merge branch 'jk/add-ignore-errors-bit-assignment-fix'Libravatar Junio C Hamano4-5/+15
"git add --ignore-errors" did not work as advertised and instead worked as an unintended synonym for "git add --renormalize", which has been fixed. * jk/add-ignore-errors-bit-assignment-fix: add: use separate ADD_CACHE_RENORMALIZE flag
2019-02-05Merge branch 'js/mingw-unc-path-w-backslashes'Libravatar Junio C Hamano3-1/+91
In Git for Windows, "git clone \\server\share\path" etc. that uses UNC paths from command line had bad interaction with its shell emulation. * js/mingw-unc-path-w-backslashes: mingw: special-case arguments to `sh` mingw (t5580): document bug when cloning from backslashed UNC paths
2019-02-05Merge branch 'cc/test-ref-store-typofix'Libravatar Junio C Hamano1-1/+1
An obvious typo in an assertion error message has been fixed. * cc/test-ref-store-typofix: helper/test-ref-store: fix "new-sha1" vs "old-sha1" typo
2019-02-05Merge branch 'jt/fetch-v2-sideband'Libravatar Junio C Hamano23-301/+520
"git fetch" and "git upload-pack" learned to send all exchange over the sideband channel while talking the v2 protocol. * jt/fetch-v2-sideband: tests: define GIT_TEST_SIDEBAND_ALL {fetch,upload}-pack: sideband v2 fetch response sideband: reverse its dependency on pkt-line pkt-line: introduce struct packet_writer pack-protocol.txt: accept error packets in any context Use packet_reader instead of packet_read_line
2019-02-05Merge branch 'sg/obstack-cast-function-type-fix'Libravatar Junio C Hamano2-15/+20
The compat/obstack code had casts that -Wcast-function-type compilation option found questionable. * sg/obstack-cast-function-type-fix: compat/obstack: fix -Wcast-function-type warnings
2019-02-05Merge branch 'js/commit-graph-chunk-table-fix'Libravatar Junio C Hamano6-23/+83
The codepath to read from the commit-graph file attempted to read past the end of it when the file's table-of-contents was corrupt. * js/commit-graph-chunk-table-fix: Makefile: correct example fuzz build commit-graph: fix buffer read-overflow commit-graph, fuzz: add fuzzer for commit-graph
2019-02-05Merge branch 'ld/git-p4-shelve-update-fix'Libravatar Junio C Hamano2-3/+56
"git p4" failed to update a shelved change when there were moved files, which has been corrected. * ld/git-p4-shelve-update-fix: git-p4: handle update of moved/copied files when updating a shelve git-p4: add failing test for shelved CL update involving move/copy
2019-02-05Merge branch 'jt/get-reference-with-commit-graph'Libravatar Junio C Hamano1-1/+14
Micro-optimize the code that prepares commit objects to be walked by "git rev-list" when the commit-graph is available. * jt/get-reference-with-commit-graph: revision: use commit graph in get_reference()
2019-02-05Merge branch 'js/filter-options-should-use-plain-int'Libravatar Junio C Hamano11-44/+329
Update the protocol message specification to allow only the limited use of scaled quantities. This is ensure potential compatibility issues will not go out of hand. * js/filter-options-should-use-plain-int: filter-options: expand scaled numbers tree:<depth>: skip some trees even when collecting omits list-objects-filter: teach tree:# how to handle >0
2019-02-05Merge branch 'sb/more-repo-in-api'Libravatar Junio C Hamano20-150/+452
The in-core repository instances are passed through more codepaths. * sb/more-repo-in-api: (23 commits) t/helper/test-repository: celebrate independence from the_repository path.h: make REPO_GIT_PATH_FUNC repository agnostic commit: prepare free_commit_buffer and release_commit_memory for any repo commit-graph: convert remaining functions to handle any repo submodule: don't add submodule as odb for push submodule: use submodule repos for object lookup pretty: prepare format_commit_message to handle arbitrary repositories commit: prepare logmsg_reencode to handle arbitrary repositories commit: prepare repo_unuse_commit_buffer to handle any repo commit: prepare get_commit_buffer to handle any repo commit-reach: prepare in_merge_bases[_many] to handle any repo commit-reach: prepare get_merge_bases to handle any repo commit-reach.c: allow get_merge_bases_many_0 to handle any repo commit-reach.c: allow remove_redundant to handle any repo commit-reach.c: allow merge_bases_many to handle any repo commit-reach.c: allow paint_down_to_common to handle any repo commit: allow parse_commit* to handle any repo object: parse_object to honor its repository argument object-store: prepare has_{sha1, object}_file to handle any repo object-store: prepare read_object_file to deal with any repo ...
2019-01-29Fourth batch after 2.20Libravatar Junio C Hamano1-0/+54
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-29Merge branch 'it/log-format-source'Libravatar Junio C Hamano7-1/+71
Custom userformat "log --format" learned %S atom that stands for the tip the traversal reached the commit from, i.e. --source. * it/log-format-source: log: add %S option (like --source) to log --format
2019-01-29Merge branch 'js/add-e-clear-patch-before-stating'Libravatar Junio C Hamano1-1/+1
"git add -e" got confused when the change it wants to let the user edit is smaller than the previous change that was left over in a temporary file. * js/add-e-clear-patch-before-stating: add --edit: truncate the patch file
2019-01-29Merge branch 'bc/tree-walk-oid'Libravatar Junio C Hamano21-98/+84
The code to walk tree objects has been taught that we may be working with object names that are not computed with SHA-1. * bc/tree-walk-oid: cache: make oidcpy always copy GIT_MAX_RAWSZ bytes tree-walk: store object_id in a separate member match-trees: use hashcpy to splice trees match-trees: compute buffer offset correctly when splicing tree-walk: copy object ID before use
2019-01-29Merge branch 'jt/upload-pack-deepen-relative-proto-v2'Libravatar Junio C Hamano4-4/+80
"git fetch --deepen=<more>" has been corrected to work over v2 protocol. * jt/upload-pack-deepen-relative-proto-v2: upload-pack: teach deepen-relative in protocol v2 fetch-pack: do not take shallow lock unnecessarily
2019-01-29Merge branch 'jk/remote-insteadof-cleanup'Libravatar Junio C Hamano1-2/+2
Code clean-up. * jk/remote-insteadof-cleanup: remote: check config validity before creating rewrite struct
2019-01-29Merge branch 'ms/http-no-more-failonerror'Libravatar Junio C Hamano5-19/+72
Debugging help for http transport. * ms/http-no-more-failonerror: test: test GIT_CURL_VERBOSE=1 shows an error remote-curl: unset CURLOPT_FAILONERROR remote-curl: define struct for CURLOPT_WRITEFUNCTION http: enable keep_error for HTTP requests http: support file handles for HTTP_KEEP_ERROR
2019-01-29Merge branch 'os/rebase-runs-post-checkout-hook'Libravatar Junio C Hamano2-56/+52
"git rebase" internally runs "checkout" to switch between branches, and the command used to call the post-checkout hook, but the reimplementation stopped doing so, which is getting fixed. * os/rebase-runs-post-checkout-hook: rebase: run post-checkout hook on checkout t5403: simplify by using a single repository
2019-01-29Merge branch 'bc/sha-256'Libravatar Junio C Hamano16-94/+642
Add sha-256 hash and plug it through the code to allow building Git with the "NewHash". * bc/sha-256: hash: add an SHA-256 implementation using OpenSSL sha256: add an SHA-256 implementation using libgcrypt Add a base implementation of SHA-256 support commit-graph: convert to using the_hash_algo t/helper: add a test helper to compute hash speed sha1-file: add a constant for hash block size t: make the sha1 test-tool helper generic t: add basic tests for our SHA-1 implementation cache: make hashcmp and hasheq work with larger hashes hex: introduce functions to print arbitrary hashes sha1-file: provide functions to look up hash algorithms sha1-file: rename algorithm to "sha1"
2019-01-29Merge branch 'sb/submodule-recursive-fetch-gets-the-tip'Libravatar Junio C Hamano12-89/+426
"git fetch --recurse-submodules" may not fetch the necessary commit that is bound to the superproject, which is getting corrected. * sb/submodule-recursive-fetch-gets-the-tip: fetch: ensure submodule objects fetched submodule.c: fetch in submodules git directory instead of in worktree submodule: migrate get_next_submodule to use repository structs repository: repo_submodule_init to take a submodule struct submodule: store OIDs in changed_submodule_names submodule.c: tighten scope of changed_submodule_names struct submodule.c: sort changed_submodule_names before searching it submodule.c: fix indentation sha1-array: provide oid_array_filter
2019-01-29Merge branch 'jt/fetch-pack-v2'Libravatar Junio C Hamano2-10/+21
"git fetch-pack" now can talk the version 2 protocol. * jt/fetch-pack-v2: fetch-pack: support protocol version 2
2019-01-29Merge branch 'jk/proto-v2-hidden-refs-fix'Libravatar Junio C Hamano2-0/+22
The v2 upload-pack protocol implementation failed to honor hidden-ref configuration, which has been corrected. An earlier attempt reverted out of 'next'. * jk/proto-v2-hidden-refs-fix: upload-pack: support hidden refs with protocol v2
2019-01-29Merge branch 'jk/save-getenv-result'Libravatar Junio C Hamano6-12/+23
There were many places the code relied on the string returned from getenv() to be non-volatile, which is not true, that have been corrected. * jk/save-getenv-result: builtin_diff(): read $GIT_DIFF_OPTS closer to use merge-recursive: copy $GITHEAD strings init: make a copy of $GIT_DIR string config: make a copy of $GIT_CONFIG string commit: copy saved getenv() result get_super_prefix(): copy getenv() result
2019-01-29Merge branch 'pw/diff-color-moved-ws-fix'Libravatar Junio C Hamano4-87/+256
"git diff --color-moved-ws" updates. * pw/diff-color-moved-ws-fix: diff --color-moved-ws: handle blank lines diff --color-moved-ws: modify allow-indentation-change diff --color-moved-ws: optimize allow-indentation-change diff --color-moved=zebra: be stricter with color alternation diff --color-moved-ws: fix false positives diff --color-moved-ws: demonstrate false positives diff: allow --no-color-moved-ws Use "whitespace" consistently diff: document --no-color-moved
2019-01-29Merge branch 'ja/doc-build-l10n'Libravatar Junio C Hamano1-5/+17
Prepare Documentation/Makefile so that manpage localization can reuse it by overriding and tweaking the list of build products. * ja/doc-build-l10n: Documentation/Makefile add optional targets for l10n
2019-01-29Merge branch 'js/rebase-i-redo-exec'Libravatar Junio C Hamano9-5/+108
"git rebase -i" learned to re-execute a command given with 'exec' to run after it failed the last time. * js/rebase-i-redo-exec: rebase: introduce a shortcut for --reschedule-failed-exec rebase: add a config option to default to --reschedule-failed-exec rebase: introduce --reschedule-failed-exec
2019-01-29Merge branch 'cc/fetch-error-message-fix'Libravatar Junio C Hamano1-2/+4
Error message fix. * cc/fetch-error-message-fix: fetch: fix extensions.partialclone name in error message
2019-01-29Merge branch 'cc/partial-clone-doc-typofix'Libravatar Junio C Hamano1-1/+1
Doc fix. * cc/partial-clone-doc-typofix: partial-clone: add missing 'is' in doc
2019-01-29Merge branch 'kg/external-diff-save-env'Libravatar Junio C Hamano1-1/+1
The code to drive GIT_EXTERNAL_DIFF command relied on the string returned from getenv() to be non-volatile, which is not true, that has been corrected. * kg/external-diff-save-env: diff: ensure correct lifetime of external_diff_cmd
2019-01-28pack-objects: merge read_lock and lock in packing_data structLibravatar Patrick Hogg3-31/+19
Rename the packing_data lock to obd_lock and upgrade it to a recursive mutex to make it suitable for current read_lock usages. Additionally remove the superfluous #ifndef NO_PTHREADS guard around mutex initialization in prepare_packing_data as the mutex functions themselves are already protected. Signed-off-by: Patrick Hogg <phogg@novamoon.net> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-28pack-objects: move read mutex to packing_data structLibravatar Patrick Hogg3-5/+13
ac77d0c37 ("pack-objects: shrink size field in struct object_entry", 2018-04-14) added an extra usage of read_lock/read_unlock in the newly introduced oe_get_size_slow for thread safety in parallel calls to try_delta(). Unfortunately oe_get_size_slow is also used in serial code, some of which is called before the first invocation of ll_find_deltas. As such the read mutex is not guaranteed to be initialized. Resolve this by moving the read mutex to packing_data and initializing it in prepare_packing_data which is initialized in cmd_pack_objects. Signed-off-by: Patrick Hogg <phogg@novamoon.net> Reviewed-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24combine-diff: treat --dirstat like --statLibravatar Jeff King3-0/+5
Currently "--cc --dirstat" will show nothing for a merge. Like --shortstat and --summary in the previous two patches, it probably makes sense to treat it like we do --stat, and show a stat against the first-parent. This case is less obviously correct than for --shortstat and --summary, as those are basically variants of --stat themselves. It's possible we could develop a multi-parent combined dirstat format, in which case we might regret defining this first-parent behavior. But the same could be said for --stat, and in the 12+ years of it showing first-parent stats, nobody has complained. So showing the first-parent dirstat is at least _useful_, and if we later develop a clever multi-parent stat format, we'd probably have to deal with --stat anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24combine-diff: treat --summary like --statLibravatar Jeff King3-0/+14
Currently "--cc --summary" on a merge shows nothing. Since we show "--cc --stat" as a stat against the first parent, and because --summary is typically used in combination with --stat, it makes sense to treat them both the same way. Note that we have to tweak t4013's setup a bit to test this case, as the existing merges do not have any --summary results against their first parent. But since the merge at the tip of 'master' does add and remove files with respect to the second parent, we can just make a reversed doppelganger merge where the parents are swapped. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24combine-diff: treat --shortstat like --statLibravatar Jeff King3-0/+6
The --stat of a combined diff is defined as the first-parent stat, going all the way back to 965f803c32 (combine-diff: show diffstat with the first parent., 2006-04-17). Naturally, we gave --numstat the same treatment in 74e2abe5b7 (diff --numstat, 2006-10-12). But --shortstat, which is really just the final line of --stat, does nothing, which produces confusing results: $ git show --oneline --stat eab7584e37 eab7584e37 Merge branch 'en/show-ref-doc-fix' Documentation/git-show-ref.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) $ git show --oneline --shortstat eab7584e37 eab7584e37 Merge branch 'en/show-ref-doc-fix' [nothing! We'd expect to see the "1 file changed..." line] This patch teaches combine-diff to treats the two formats identically. Reported-by: David Turner <novalis@novalis.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24combine-diff: factor out stat-format maskLibravatar Jeff King1-6/+8
There are several conditionals in the combine diff code that check if we're doing --stat or --numstat output. Since these must all remain in sync, let's pull them out into a separate bit-mask. Arguably this could go into diff.h along with the other DIFF_FORMAT macros, but it's not clear that the definition of "which formats are stat" is universal (e.g., does --dirstat count? --summary?). So let's keep this local to combine-diff.c, where the meaning is more clearly "stat formats that combine-diff supports". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24diff: clear emitted_symbols flag after useLibravatar Jeff King2-1/+82
There's an odd bug when "log --color-moved" is used with the combination of "--cc --stat -p": the stat for merge commits is erroneously shown with the diff of the _next_ commit. The included test demonstrates the issue. Our history looks something like this: A-B-M--D \ / C When we run "git log --cc --stat -p --color-moved" starting at D, we get this sequence of events: 1. The diff for D is using -p, so diff_flush() calls into diff_flush_patch_all_file_pairs(). There we see that o->color_moved is in effect, so we point o->emitted_symbols to a static local struct, causing diff_flush_patch() to queue the symbols instead of actually writing them out. We then do our move detection, emit the symbols, and clear the struct. But we leave o->emitted_symbols pointing to our struct. 2. Next we compute the diff for M. This is a merge, so we use the combined diff code. In find_paths_generic(), we compute the pairwise diff between each commit and its parent. Normally this is done with DIFF_FORMAT_NO_OUTPUT, since we're just looking for intersecting paths. But since "--stat --cc" shows the first-parent stat, and since we're computing that diff anyway, we enable DIFF_FORMAT_DIFFSTAT for the first parent. This outputs the stat information immediately, saving us from running a separate first-parent diff later. But where does that output go? Normally it goes directly to stdout, but because o->emitted_symbols is set, we queue it. As a result, we don't actually print the diffstat for the merge commit (yet), which is wrong. 3. Next we compute the diff for C. We're actually showing a patch again, so we end up in diff_flush_patch_all_file_pairs(), but this time we have the queued stat from step 2 waiting in our struct. We add new elements to it for C's diff, and then flush the whole thing. And we see the diffstat from M as part of C's diff, which is wrong. So triggering the bug really does require the combination of all of those options. To fix it, we can simply restore o->emitted_symbols to NULL after flushing it, so that it does not affect anything outside of diff_flush_patch_all_file_pairs(). This intuitively makes sense, since nobody outside of that function is going to bother flushing it, so we would not want them to write to it either. In fact, we could take this a step further and turn the local "esm" struct into a non-static variable that goes away after the function ends. However, since it contains a dynamically sized array, we benefit from amortizing the cost of allocations over many calls. So we'll leave it as static to retain that benefit. But let's push the zero-ing of esm.nr into the conditional for "if (o->emitted_symbols)" to make it clear that we do not expect esm to hold any values if we did not just try to use it. With the code as it is written now, if we did encounter such a case (which I think would be a bug), we'd silently leak those values without even bothering to display them. With this change, we'd at least eventually show them, and somebody would notice. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24t4006: resurrect commented-out testsLibravatar Jeff King1-23/+32
This set of tests was added by 4434e6ba6c (tests: check --[short]stat output after chmod, 2012-05-01), and is primarily about the handling of binary versus text files. Later, 74faaa16f0 (Fix "git diff --stat" for interesting - but empty - file changes, 2012-10-17) changed the stat output so that the empty text file is mentioned rather than omitted. That commit just comments out these tests. There's no discussion in the commit message, but the original email[1] says: NOTE! This does break two of our tests, so we clearly did this on purpose, or at least tested for it. I just uncommented the subtests that this makes irrelevant, and changed the output of another one. I don't think they're irrelevant, though. We should be testing this "mode change only" case and making sure that it has the post-74faaa16f0 behavior. So this commit brings back those tests, with the current expected output. [1] https://public-inbox.org/git/CA+55aFz88GPJcfMSqiyY+u0Cdm48bEyrsTGxHVJbGsYsDg=Q5w@mail.gmail.com/ Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-23checkout: fix regression in checkout -b on intitial checkoutLibravatar Ben Peart2-1/+9
When doing a 'checkout -b' do a full checkout including updating the working tree when doing the initial checkout. As the new test involves an filesystem access, do it later in the sequence to give chance to other cheaper tests to leave early. This fixes the regression in behavior caused by fa655d8411 (checkout: optimize "git checkout -b <new_branch>", 2018-08-16). Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-23checkout: add test demonstrating regression with checkout -b on initial commitLibravatar Ben Peart1-0/+9
Commit fa655d8411 (checkout: optimize "git checkout -b <new_branch>", 2018-08-16) introduced an unintentional change in behavior for 'checkout -b' after doing 'clone --no-checkout'. Add a test to demonstrate the changed behavior to be used in a later patch to verify the fix. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>