Junio C Hamano [Wed, 21 Feb 2018 21:18:52 +0000 (13:18 -0800)]
Merge branch 'bw/protocol-v2' into jch
The beginning of the next-gen transfer protocol.
* bw/protocol-v2: (35 commits)
remote-curl: don't request v2 when pushing
remote-curl: implement stateless-connect command
http: don't always add Git-Protocol header
http: allow providing extra headers for http requests
remote-curl: store the protocol version the server responded with
remote-curl: create copy of the service name
pkt-line: add packet_buf_write_len function
transport-helper: introduce stateless-connect
transport-helper: refactor process_connect_service
transport-helper: remove name parameter
connect: don't request v2 when pushing
connect: refactor git_connect to only get the protocol version once
fetch-pack: support shallow requests
upload-pack: support shallow requests
fetch-pack: perform a fetch using v2
upload-pack: introduce fetch server command
push: pass ref patterns when pushing
fetch: pass ref patterns when fetching
ls-remote: pass ref patterns when requesting a remote's refs
transport: convert transport_get_remote_refs to take a list of ref patterns
...
Junio C Hamano [Wed, 21 Feb 2018 21:18:51 +0000 (13:18 -0800)]
Merge branch 'nd/worktree-move' into jch
"git worktree" learned move and remove subcommands.
* nd/worktree-move:
worktree remove: allow it when $GIT_WORK_TREE is already gone
worktree remove: new command
worktree move: refuse to move worktrees with submodules
worktree move: accept destination as directory
worktree move: new command
worktree.c: add update_worktree_location()
worktree.c: add validate_worktree()
Junio C Hamano [Wed, 21 Feb 2018 21:18:51 +0000 (13:18 -0800)]
Merge branch 'xz/send-email-batch-size' into jch
"git send-email" learned to complain when the batch-size option is
not defined when the relogin-delay option is, since these two are
mutually required.
* xz/send-email-batch-size:
send-email: error out when relogin delay is missing
Junio C Hamano [Wed, 21 Feb 2018 21:18:50 +0000 (13:18 -0800)]
Merge branch 'cl/send-email-reply-to' into jch
"git send-email" learned "--reply-to=<address>" option.
* cl/send-email-reply-to:
send-email: support separate "Reply-To" address
send-email: rename variables for "In-reply-to" to $foo_in_reply_to
Junio C Hamano [Wed, 21 Feb 2018 21:18:50 +0000 (13:18 -0800)]
Merge branch 'sg/travis-build-during-script-phase' into jch
So... what do we want to do with this thing?
* sg/travis-build-during-script-phase:
travis-ci: build Git during the 'script' phase
Junio C Hamano [Wed, 21 Feb 2018 21:18:49 +0000 (13:18 -0800)]
Merge branch 'jh/status-no-ahead-behind' into jch
"git status" can spend a lot of cycles to compute the relation
between the current branch and its upstream, which can now be
disabled with "--no-ahead-behind" option.
At v5; is this ready for 'next'?
* jh/status-no-ahead-behind:
status: support --no-ahead-behind in long format
status: update short status to respect --no-ahead-behind
status: add --[no-]ahead-behind to status and commit for V2 format.
stat_tracking_info: return +1 when branches not equal
Junio C Hamano [Wed, 21 Feb 2018 21:18:48 +0000 (13:18 -0800)]
Merge branch 'bw/doc-submodule-recurse-config-with-clone' into jch
* bw/doc-submodule-recurse-config-with-clone:
submodule: indicate that 'submodule.recurse' doesn't apply to clone
Junio C Hamano [Wed, 21 Feb 2018 20:46:50 +0000 (12:46 -0800)]
### match next
Junio C Hamano [Wed, 21 Feb 2018 20:46:50 +0000 (12:46 -0800)]
Merge branch 'nd/am-quit' into jch
"git am" has learned "--quit" option, in addition to the existing
"--abort" option; having the pair mirrors a few other commands like
"rebase" and "cherry-pick".
* nd/am-quit:
am: support --quit
Junio C Hamano [Wed, 21 Feb 2018 20:46:49 +0000 (12:46 -0800)]
Merge branch 'es/worktree-add-post-checkout-hook' into jch
"git worktree add" learned to run the post-checkout hook, just like
"git clone" runs it upon the initial checkout.
* es/worktree-add-post-checkout-hook:
worktree: add: fix 'post-checkout' not knowing new worktree location
Junio C Hamano [Wed, 21 Feb 2018 20:46:49 +0000 (12:46 -0800)]
Merge branch 'sb/status-doc-fix' into jch
Docfix.
* sb/status-doc-fix:
Documentation/git-status: clarify status table for porcelain mode
Junio C Hamano [Wed, 21 Feb 2018 20:46:48 +0000 (12:46 -0800)]
Merge branch 'tk/apply-dev-null-verify-name-fix' into jch
Many places in "git apply" knew that "/dev/null" that signals
"there is no such file on this side of the diff" can be followed by
whitespace and garbage when parsing a patch, except for one, which
made an otherwise valid patch (e.g. ones from subversion) rejected.
* tk/apply-dev-null-verify-name-fix:
apply: handle Subversion diffs with /dev/null gracefully
apply: demonstrate a problem applying svn diffs
Junio C Hamano [Wed, 21 Feb 2018 20:46:47 +0000 (12:46 -0800)]
Merge branch 'gs/test-unset-xdg-cache-home' into jch
* gs/test-unset-xdg-cache-home:
test-lib.sh: unset XDG_CACHE_HOME
Junio C Hamano [Wed, 21 Feb 2018 20:46:45 +0000 (12:46 -0800)]
Merge branch 'tg/worktree-create-tracking' into jch
Hotfix for a recent topic.
* tg/worktree-create-tracking:
git-worktree.txt: fix indentation of example and text of 'add' command
git-worktree.txt: fix missing ")" typo
Junio C Hamano [Wed, 21 Feb 2018 20:46:45 +0000 (12:46 -0800)]
Merge branch 'tz/do-not-clean-spec-file' into jch
We no longer create any *.spec file, so "make clean" should not
remove it.
* tz/do-not-clean-spec-file:
Makefile: remove *.spec from clean target
Junio C Hamano [Wed, 21 Feb 2018 20:46:44 +0000 (12:46 -0800)]
Merge branch 'jk/push-options-via-transport-fix' into jch
"git push" over http transport did not unquote the push-options
correctly.
* jk/push-options-via-transport-fix:
remote-curl: unquote incoming push-options
t5545: factor out http repository setup
Junio C Hamano [Wed, 21 Feb 2018 20:46:43 +0000 (12:46 -0800)]
Merge branch 'bp/fsmonitor' into jch
Doc update for a recently added feature.
* bp/fsmonitor:
fsmonitor: update documentation to remove reference to invalid config settings
Junio C Hamano [Wed, 21 Feb 2018 20:46:42 +0000 (12:46 -0800)]
Merge branch 'jk/sq-dequote-on-bogus-input' into jch
Code to unquote single-quoted string (used in the parser for
configuration files, etc.) did not diagnose bogus input correctly
and produced bogus results instead.
* jk/sq-dequote-on-bogus-input:
sq_dequote: fix extra consumption of source string
Junio C Hamano [Wed, 21 Feb 2018 20:46:41 +0000 (12:46 -0800)]
Merge branch 'jk/test-hashmap-updates' into jch
Code clean-up.
* jk/test-hashmap-updates:
test-hashmap: use "unsigned int" for hash storage
test-hashmap: simplify alloc_test_entry
test-hashmap: use strbuf_getline rather than fgets
test-hashmap: use xsnprintf rather than snprintf
test-hashmap: check allocation computation for overflow
test-hashmap: use ALLOC_ARRAY rather than bare malloc
Junio C Hamano [Wed, 21 Feb 2018 20:46:41 +0000 (12:46 -0800)]
Merge branch 'rd/typofix' into jch
Typofix.
* rd/typofix:
Correct mispellings of ".gitmodule" to ".gitmodules"
t/: correct obvious typo "detahced"
Junio C Hamano [Wed, 21 Feb 2018 20:46:41 +0000 (12:46 -0800)]
Merge branch 'bc/doc-interpret-trailers-grammofix' into jch
Docfix.
* bc/doc-interpret-trailers-grammofix:
docs/interpret-trailers: fix agreement error
Junio C Hamano [Wed, 21 Feb 2018 20:46:40 +0000 (12:46 -0800)]
Merge branch 'as/ll-i18n' into jch
Some messages in low level start-up codepath have been i18n-ized.
* as/ll-i18n:
Mark messages for translations
Junio C Hamano [Wed, 21 Feb 2018 20:46:39 +0000 (12:46 -0800)]
Merge branch 'sg/doc-test-must-fail-args' into jch
Devdoc update.
* sg/doc-test-must-fail-args:
t: document 'test_must_fail ok=<signal-name>'
Junio C Hamano [Wed, 21 Feb 2018 20:46:38 +0000 (12:46 -0800)]
Merge branch 'sb/describe-blob' into jch
"git describe $garbage" stopped giving any errors when the garbage
happens to be a string with 40 hexadecimal letters.
* sb/describe-blob:
describe: confirm that blobs actually exist
Junio C Hamano [Wed, 21 Feb 2018 20:46:37 +0000 (12:46 -0800)]
Merge branch 'rs/check-ignore-multi' into jch
"git check-ignore" with multiple paths got confused when one is a
file and the other is a directory, which has been fixed.
* rs/check-ignore-multi:
check-ignore: fix mix of directories and other file types
Junio C Hamano [Wed, 21 Feb 2018 20:46:37 +0000 (12:46 -0800)]
Merge branch 'rj/sparse-updates' into jch
Devtool update.
* rj/sparse-updates:
Makefile: suppress a sparse warning for pack-revindex.c
config.mak.uname: remove SPARSE_FLAGS setting for cygwin
Junio C Hamano [Wed, 21 Feb 2018 20:46:36 +0000 (12:46 -0800)]
Merge branch 'jk/t0002-simplify' into jch
Code cleanup.
* jk/t0002-simplify:
t0002: simplify error checking
Junio C Hamano [Wed, 21 Feb 2018 20:46:36 +0000 (12:46 -0800)]
Merge branch 'ab/untracked-cache-invalidation-docs' into jch
Doc update to warn against remaining bugs in untracked cache.
* ab/untracked-cache-invalidation-docs:
update-index doc: note the caveat with "could not open..."
update-index doc: note a fixed bug in the untracked cache
Junio C Hamano [Wed, 21 Feb 2018 20:46:36 +0000 (12:46 -0800)]
Merge branch 'js/packet-read-line-check-null' into jch
Some low level protocol codepath could crash when they get an
unexpected flush packet, which is now fixed.
* js/packet-read-line-check-null:
always check for NULL return from packet_read_line()
correct error messages for NULL packet_read_line()
Junio C Hamano [Wed, 21 Feb 2018 20:46:35 +0000 (12:46 -0800)]
Merge branch 'js/fix-merge-arg-quoting-in-rebase-p' into jch
"git rebase -p" mangled log messages of a merge commit, which is
now fixed.
* js/fix-merge-arg-quoting-in-rebase-p:
rebase -p: fix incorrect commit message when calling `git merge`.
Junio C Hamano [Wed, 21 Feb 2018 20:46:35 +0000 (12:46 -0800)]
Merge branch 'jk/gettext-poison' into jch
Test updates.
* jk/gettext-poison:
git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME
t0205: drop redundant test
Junio C Hamano [Wed, 21 Feb 2018 20:46:35 +0000 (12:46 -0800)]
Merge branch 'jk/doc-do-not-write-extern' into jch
Devdoc update.
* jk/doc-do-not-write-extern:
CodingGuidelines: mention "static" and "extern"
Junio C Hamano [Wed, 21 Feb 2018 20:46:34 +0000 (12:46 -0800)]
Merge branch 'bp/name-hash-dirname-fix' into jch
"git add" files in the same directory, but spelling the directory
path in different cases on case insensitive filesystem, corrupted
the name hash data structure and led to unexpected results. This
has been corrected.
* bp/name-hash-dirname-fix:
name-hash: properly fold directory names in adjust_dirname_case()
Junio C Hamano [Wed, 21 Feb 2018 20:46:33 +0000 (12:46 -0800)]
Merge branch 'jc/blame-missing-path' into jch
"git blame HEAD COPYING" in a bare repository failed to run, while
"git blame HEAD -- COPYING" run just fine. This has been corrected.
* jc/blame-missing-path:
blame: tighten command line parser
Junio C Hamano [Wed, 21 Feb 2018 20:46:33 +0000 (12:46 -0800)]
Merge branch 'nd/fix-untracked-cache-invalidation' into jch
Some bugs around "untracked cache" feature have been fixed.
Seems to uncover bad untracked cache information a bit too loudly,
for which there is ab/untracked-cache-invalidation-docs topic.
cf. <87d11omi2o.fsf@evledraar.gmail.com>
* nd/fix-untracked-cache-invalidation:
dir.c: ignore paths containing .git when invalidating untracked cache
dir.c: stop ignoring opendir() error in open_cached_dir()
dir.c: fix missing dir invalidation in untracked code
dir.c: avoid stat() in valid_cached_dir()
status: add a failing test showing a core.untrackedCache bug
Junio C Hamano [Wed, 21 Feb 2018 20:46:32 +0000 (12:46 -0800)]
Merge branch 'jt/binsearch-with-fanout' into jch
Refactor the code to binary search starting from a fan-out table
(which is how the packfile is indexed with object names) into a
reusable helper.
* jt/binsearch-with-fanout:
packfile: refactor hash search with fanout table
packfile: remove GIT_DEBUG_LOOKUP log statements
Junio C Hamano [Wed, 21 Feb 2018 20:45:35 +0000 (12:45 -0800)]
Fourth batch for 2.17
Junio C Hamano [Wed, 21 Feb 2018 20:45:05 +0000 (12:45 -0800)]
Merge branch 'sg/test-i18ngrep'
Test fixes.
* sg/test-i18ngrep:
t: make 'test_i18ngrep' more informative on failure
t: validate 'test_i18ngrep's parameters
t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'
t5536: let 'test_i18ngrep' read the file without redirection
t5510: consolidate 'grep' and 'test_i18ngrep' patterns
t4001: don't run 'git status' upstream of a pipe
t6022: don't run 'git merge' upstream of a pipe
t5812: add 'test_i18ngrep's missing filename parameter
t5541: add 'test_i18ngrep's missing filename parameter
Junio C Hamano [Wed, 21 Feb 2018 20:45:04 +0000 (12:45 -0800)]
Merge branch 'gs/rebase-allow-empty-message'
"git rebase" learned to take "--allow-empty-message" option.
* gs/rebase-allow-empty-message:
rebase: add --allow-empty-message option
Junio C Hamano [Wed, 21 Feb 2018 20:45:04 +0000 (12:45 -0800)]
Merge branch 'lw/daemon-log-destination'
The log from "git daemon" can be redirected with a new option; one
relevant use case is to send the log to standard error (instead of
syslog) when running it from inetd.
* lw/daemon-log-destination:
daemon: add --log-destination=(stderr|syslog|none)
Junio C Hamano [Wed, 21 Feb 2018 20:45:04 +0000 (12:45 -0800)]
Merge branch 'nd/format-patch-stat-width'
"git format-patch" learned to give 72-cols to diffstat, which is
consistent with other line length limits the subcommand uses for
its output meant for e-mails.
* nd/format-patch-stat-width:
format-patch: reduce patch diffstat width to 72
format-patch: keep cover-letter diffstat wrapped in 72 columns
Brandon Williams [Tue, 20 Feb 2018 20:29:22 +0000 (12:29 -0800)]
submodule: indicate that 'submodule.recurse' doesn't apply to clone
Update the documentation for the 'submodule.recurse' config to identify
that the clone command does not respect it.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Olga Telezhnaya [Wed, 21 Feb 2018 06:59:01 +0000 (06:59 +0000)]
ref-filter: get rid of goto
Get rid of goto command in ref-filter for better readability.
Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Olga Telezhnaya [Wed, 21 Feb 2018 06:59:00 +0000 (06:59 +0000)]
ref-filter: get rid of duplicate code
Make one function from 2 duplicate pieces and invoke it twice.
Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:26 +0000 (13:53 -0500)]
commit-graph: build graph from starting commits
Teach git-commit-graph to read commits from stdin when the
--stdin-commits flag is specified. Commits reachable from these
commits are added to the graph. This is a much faster way to construct
the graph than inspecting all packed objects, but is restricted to
known tips.
For the Linux repository, 700,000+ commits were added to the graph
file starting from 'master' in 7-9 seconds, depending on the number
of packfiles in the repo (1, 24, or 120). If a commit graph file
already exists (and core.commitGraph=true), then this operation takes
only 1.8 seconds due to less time spent parsing commits.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:25 +0000 (13:53 -0500)]
commit-graph: read only from specific pack-indexes
Teach git-commit-graph to inspect the objects only in a certain list
of pack-indexes within the given pack directory. This allows updating
the commit graph iteratively, since we add all commits stored in a
previous commit graph.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:24 +0000 (13:53 -0500)]
commit: integrate commit graph with commit parsing
Teach Git to inspect a commit graph file to supply the contents of a
struct commit when calling parse_commit_gently(). This implementation
satisfies all post-conditions on the struct commit, including loading
parents, the root tree, and the commit date. The only loosely-expected
condition is that the commit buffer is loaded into the cache. This
was checked in log-tree.c:show_log(), but the "return;" on failure
produced unexpected results (i.e. the message line was never terminated).
The new behavior of loading the buffer when needed prevents the
unexpected behavior.
If core.commitGraph is false, then do not check graph files.
In test script t5318-commit-graph.sh, add output-matching conditions on
read-only graph operations.
By loading commits from the graph instead of parsing commit buffers, we
save a lot of time on long commit walks. Here are some performance
results for a copy of the Linux repository where 'master' has 704,766
reachable commits and is behind 'origin/master' by 19,610 commits.
| Command | Before | After | Rel % |
|----------------------------------|--------|--------|-------|
| log --oneline --topo-order -1000 | 5.9s | 0.7s | -88% |
| branch -vv | 0.42s | 0.27s | -35% |
| rev-list --all | 6.4s | 1.0s | -84% |
| rev-list --all --objects | 32.6s | 27.6s | -15% |
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:23 +0000 (13:53 -0500)]
commit-graph: close under reachability
Teach write_commit_graph() to walk all parents from the commits
discovered in packfiles. This prevents gaps given by loose objects or
previously-missed packfiles.
Also automatically add commits from the existing graph file, if it
exists.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:22 +0000 (13:53 -0500)]
commit-graph: add core.commitGraph setting
The commit graph feature is controlled by the new core.commitGraph config
setting. This defaults to 0, so the feature is opt-in.
The intention of core.commitGraph is that a user can always stop checking
for or parsing commit graph files if core.commitGraph=0.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:21 +0000 (13:53 -0500)]
commit-graph: implement --delete-expired
Teach git-commit-graph to delete the .graph files that are siblings of a
newly-written graph file, except for the file referenced by 'graph-latest'
at the beginning of the process and the newly-written file. If we fail to
delete a graph file, only report a warning because another git process may
be using that file. In a multi-process environment, we expect the previoius
graph file to be used by a concurrent process, so we do not delete it to
avoid race conditions.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:20 +0000 (13:53 -0500)]
commit-graph: implement --set-latest
It is possible to have multiple commit graph files in a directory, but
only one is important at a time.
Use a 'graph-latest' file to point to the important file. Teach
git-commit-graph to write 'graph-latest' when given the "--set-latest"
option. Using this 'graph-latest' file is more robust than relying on
directory scanning and modified times.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:19 +0000 (13:53 -0500)]
commit-graph: implement git commit-graph read
Teach git-commit-graph to read commit graph files and summarize their contents.
Use the read subcommand to verify the contents of a commit graph file in the
tests.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:18 +0000 (13:53 -0500)]
commit-graph: implement 'git-commit-graph write'
Teach git-commit-graph to write graph files. Create new test script to verify
this command succeeds without failure.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:17 +0000 (13:53 -0500)]
commit-graph: implement write_commit_graph()
Teach Git to write a commit graph file by checking all packed objects
to see if they are commits, then store the file in the given object
directory.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:16 +0000 (13:53 -0500)]
commit-graph: create git-commit-graph builtin
Teach git the 'commit-graph' builtin that will be used for writing and
reading packed graph files. The current implementation is mostly
empty, except for an '--object-dir' option.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:15 +0000 (13:53 -0500)]
graph: add commit graph design document
Add Documentation/technical/commit-graph.txt with details of the planned
commit graph feature, including future plans.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 19 Feb 2018 18:53:14 +0000 (13:53 -0500)]
commit-graph: add format document
Add document specifying the binary format for commit graphs. This
format allows for:
* New versions.
* New hash functions and hash lengths.
* Optional extensions.
Basic header information is followed by a binary table of contents
into "chunks" that include:
* An ordered list of commit object IDs.
* A 256-entry fanout into that list of OIDs.
* A list of metadata for the commits.
* A list of "large edges" to enable octopus merges.
The format automatically includes two parent positions for every
commit. This favors speed over space, since using only one position
per commit would cause an extra level of indirection for every merge
commit. (Octopus merges suffer from this indirection, but they are
very rare.)
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 19 Feb 2018 19:50:14 +0000 (14:50 -0500)]
remote-curl: unquote incoming push-options
The transport-helper protocol c-style quotes the value of
any options passed to the helper via the "option <key> <value>"
directive. However, remote-curl doesn't actually unquote the
push-option values, meaning that we will send the quoted
version to the other side (whereas git-over-ssh would send
the raw value).
The pack-protocol.txt documentation defines the push-options
as a series of VCHARs, which excludes most characters that
would need quoting. But:
1. You can still see the bug with a valid push-option that
starts with a double-quote (since that triggers
quoting).
2. We do currently handle any non-NUL characters correctly
in git-over-ssh. So even though the spec does not say
that we need to handle most quoted characters, it's
nice if our behavior is consistent between protocols.
There are two new tests: the "direct" one shows that this
already works in the non-http case, and the http one covers
this bugfix.
Reported-by: Jon Simons <jon@jonsimons.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 19 Feb 2018 19:48:44 +0000 (14:48 -0500)]
t5545: factor out http repository setup
We repeat many lines of setup code in the two http tests,
and further tests would need to repeat it again. Let's
factor this out into a function.
Incidentally, this also fixes an unlikely bug: if the httpd
root path contains a double-quote, our test_when_finished
would barf due to improper quoting (we escape the embedded
quotes, but not the $, meaning we expand the variable before
the eval).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:10 +0000 (11:29 +0000)]
add -p: don't rely on apply's '--recount' option
Now that add -p counts patches properly it should be possible to turn
off the '--recount' option when invoking 'git apply'
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:09 +0000 (11:29 +0000)]
add -p: fix counting when splitting and coalescing
When a file has no trailing new line at the end diff records this by
appending "\ No newline at end of file" below the last line of the
file. This line should not be counted in the hunk header. Fix the
splitting and coalescing code to count files without a trailing new line
properly and change one of the tests to test splitting without a
trailing new line.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:08 +0000 (11:29 +0000)]
add -p: calculate offset delta for edited patches
Recount the number of preimage and postimage lines in a hunk after it
has been edited so any change in the number of insertions or deletions
can be used to adjust the offsets of subsequent hunks. If an edited
hunk is subsequently split then the offset correction will be lost. It
would be possible to fix this if it is a problem, however the code
here is still an improvement on the status quo for the common case
where an edited hunk is applied without being split.
This is also a necessary step to removing '--recount' and
'--allow-overlap' from the invocation of 'git apply'. Before
'--recount' can be removed the splitting and coalescing counting needs
to be fixed to handle a missing newline at the end of a file. In order
to remove '--allow-overlap' there needs to be i) some way of verifying
the offset data in the edited hunk (probably by correlating the
preimage (or postimage if the patch is going to be applied in reverse)
lines of the edited and unedited versions to see if they are offset or
if any leading/trailing context lines have been removed) and ii) a way of
dealing with edited hunks that change context lines that are shared
with neighbouring hunks.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:07 +0000 (11:29 +0000)]
add -p: adjust offsets of subsequent hunks when one is skipped
Since commit
8cbd431082 ("git-add--interactive: replace hunk
recounting with apply --recount", 2008-7-2) if a hunk is skipped then
we rely on the context lines to apply subsequent hunks in the right
place. While this works most of the time it is possible for hunks to
end up being applied in the wrong place. To fix this adjust the offset
of subsequent hunks to correct for any change in the number of
insertions or deletions due to the skipped hunk. The change in offset
due to edited hunks that have the number of insertions or deletions
changed is ignored here, it will be fixed in the next commit.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:06 +0000 (11:29 +0000)]
t3701: add failing test for pathological context lines
When a hunk is skipped by add -i the offsets of subsequent hunks are
not adjusted to account for any missing insertions due to the skipped
hunk. Most of the time this does not matter as apply uses the context
lines to apply the subsequent hunks in the correct place, however in
pathological cases the context lines will match at the now incorrect
offset and the hunk will be applied in the wrong place. The offsets of
hunks following an edited hunk that has had the number of insertions
or deletions changed also need to be updated in the same way. Add
failing tests to demonstrate this.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:05 +0000 (11:29 +0000)]
t3701: don't hard code sha1 hash values
Purge the index lines from diffs so we're not hard coding sha1 hash
values in the expected output.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:04 +0000 (11:29 +0000)]
t3701: use test_write_lines and write_script
Simplify things slightly by using the above helpers.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:03 +0000 (11:29 +0000)]
t3701: indent here documents
Indent here documents in line with the current style for tests.
While at it, quote the end marker of here-docs that do not use
variable interpolation.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 19 Feb 2018 11:29:02 +0000 (11:29 +0000)]
add -i: add function to format hunk header
This code is duplicated in a couple of places so make it into a
function as we're going to add some more callers shortly.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger [Sat, 17 Feb 2018 03:06:24 +0000 (22:06 -0500)]
Makefile: remove *.spec from clean target
Support for generating an rpm was dropped in
ab214331cf ("Makefile: stop
pretending to support rpmbuild", 2016-04-04). We don't generate any
*.spec files so there is no need to clean them up.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine [Fri, 16 Feb 2018 20:44:52 +0000 (15:44 -0500)]
git-worktree.txt: fix indentation of example and text of 'add' command
When
4e85333197 (worktree: make add <path> <branch> dwim, 2017-11-26)
added an example command in a literal code block, it neglected to
insert a mandatory "+" line before the block. This omission resulted
in both the literal code block and the (existing) paragraph following
the block to be outdented, even though they should be indented under
the 'add' sub-command along with the rest of the text pertaining to
that command. Furthermore, the mandatory "+" line separating the code
block from the following text got rendered as a leading character on
the line ("+ If <commit-ish>...") rather than being treated as a
formatting directive.
Fix these problems by adding the missing "+" line before the example
code block.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine [Fri, 16 Feb 2018 20:44:51 +0000 (15:44 -0500)]
git-worktree.txt: fix missing ")" typo
Add the closing ")" to a parenthetical phrase introduced by
4e85333197
(worktree: make add <path> <branch> dwim, 2017-11-26).
While at it, add a missing ":" at the end of the same sentence since
it precedes an example literal command block.
Reported-by: Mike Nordell <tamlin.thefirst@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Genki Sky [Fri, 16 Feb 2018 02:46:04 +0000 (21:46 -0500)]
test-lib.sh: unset XDG_CACHE_HOME
git respects XDG_CACHE_HOME for the credential cache. So, we should
unset XDG_CACHE_HOME for the test environment, lest a user's custom one
cause failure in the test.
For example, t/t0301-credential-cache.sh expects a default directory
to be used if it hasn't explicitly set XDG_CACHE_HOME.
Signed-off-by: Genki Sky <sky@genki.is>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 14 Feb 2018 18:18:55 +0000 (10:18 -0800)]
merge: allow fast-forward when merging a tracked tag
Long time ago at
fab47d05 ("merge: force edit and no-ff mode when
merging a tag object", 2011-11-07), "git merge" was made to always
create a merge commit when merging a tag, even when the side branch
being merged is a descendant of the current branch.
This default is good for merges made by upstream maintainers to
integrate work signed by downstream contributors, but will leave
pointless no-ff merges when downstream contributors pull a newer
release tag to make their long-running topic branches catch up with
the upstream. When there is no local work left on the topic, such a
merge should simply fast-forward to the commit pointed at by the
release tag.
Update the default (again) for "git merge" that merges a tag object
to (1) --no-ff (i.e. create a merge commit even when side branch
fast forwards) if the tag being merged is not at its expected place
in refs/tags/ hierarchy and (2) --ff (i.e. allow fast-forward update
when able) otherwise.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 15 Feb 2018 23:24:55 +0000 (15:24 -0800)]
Sync with 2.16.2
* tag 'v2.16.2':
Git 2.16.2
Junio C Hamano [Thu, 15 Feb 2018 23:21:23 +0000 (15:21 -0800)]
Git 2.16.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 15 Feb 2018 23:18:15 +0000 (15:18 -0800)]
Merge branch 'ab/doc-cat-file-e-still-shows-errors' into maint
Doc update.
* ab/doc-cat-file-e-still-shows-errors:
cat-file doc: document that -e will return some output
Junio C Hamano [Thu, 15 Feb 2018 23:18:14 +0000 (15:18 -0800)]
Merge branch 'as/read-tree-prefix-doc-fix' into maint
Doc update.
* as/read-tree-prefix-doc-fix:
doc/read-tree: remove obsolete remark
Junio C Hamano [Thu, 15 Feb 2018 23:18:13 +0000 (15:18 -0800)]
Merge branch 'nd/add-i-ignore-submodules' into maint
"git add -p" was taught to ignore local changes to submodules as
they do not interfere with the partial addition of regular changes
anyway.
* nd/add-i-ignore-submodules:
add--interactive: ignore submodule changes except HEAD
Junio C Hamano [Thu, 15 Feb 2018 23:18:13 +0000 (15:18 -0800)]
Merge branch 'tg/stash-with-pathspec-fix' into maint
"git stash -- <pathspec>" incorrectly blew away untracked files in
the directory that matched the pathspec, which has been corrected.
* tg/stash-with-pathspec-fix:
stash: don't delete untracked files that match pathspec
Junio C Hamano [Thu, 15 Feb 2018 23:18:12 +0000 (15:18 -0800)]
Merge branch 'jk/abort-clone-with-existing-dest' into maint
"git clone $there $here" is allowed even when here directory exists
as long as it is an empty directory, but the command incorrectly
removed it upon a failure of the operation.
* jk/abort-clone-with-existing-dest:
clone: do not clean up directories we didn't create
clone: factor out dir_exists() helper
t5600: modernize style
t5600: fix outdated comment about unborn HEAD
Junio C Hamano [Thu, 15 Feb 2018 23:18:12 +0000 (15:18 -0800)]
Merge branch 'jc/merge-symlink-ours-theirs' into maint
"git merge -Xours/-Xtheirs" learned to use our/their version when
resolving a conflicting updates to a symbolic link.
* jc/merge-symlink-ours-theirs:
merge: teach -Xours/-Xtheirs to symbolic link merge
Junio C Hamano [Thu, 15 Feb 2018 23:18:11 +0000 (15:18 -0800)]
Merge branch 'rs/lose-leak-pending' into maint
API clean-up around revision traversal.
* rs/lose-leak-pending:
commit: remove unused function clear_commit_marks_for_object_array()
revision: remove the unused flag leak_pending
checkout: avoid using the rev_info flag leak_pending
bundle: avoid using the rev_info flag leak_pending
bisect: avoid using the rev_info flag leak_pending
object: add clear_commit_marks_all()
ref-filter: use clear_commit_marks_many() in do_merge_filter()
commit: use clear_commit_marks_many() in remove_redundant()
commit: avoid allocation in clear_commit_marks_many()
Junio C Hamano [Thu, 15 Feb 2018 23:18:11 +0000 (15:18 -0800)]
Merge branch 'jm/svn-pushmergeinfo-fix' into maint
"git svn dcommit" did not take into account the fact that a
svn+ssh:// URL with a username@ (typically used for pushing) refers
to the same SVN repository without the username@ and failed when
svn.pushmergeinfo option is set.
* jm/svn-pushmergeinfo-fix:
git-svn: fix svn.pushmergeinfo handling of svn+ssh usernames.
Junio C Hamano [Thu, 15 Feb 2018 23:18:10 +0000 (15:18 -0800)]
Merge branch 'dk/describe-all-output-fix' into maint
An old regression in "git describe --all $annotated_tag^0" has been
fixed.
* dk/describe-all-output-fix:
describe: prepend "tags/" when describing tags with embedded name
Junio C Hamano [Thu, 15 Feb 2018 23:18:09 +0000 (15:18 -0800)]
Merge branch 'ab/perf-grep-threads' into maint
More perf tests for threaded grep
* ab/perf-grep-threads:
perf: amend the grep tests to test grep.threads
Junio C Hamano [Thu, 15 Feb 2018 22:56:49 +0000 (14:56 -0800)]
Third batch for 2.17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 15 Feb 2018 22:55:47 +0000 (14:55 -0800)]
Merge branch 'bc/hash-algo'
More abstraction of hash function from the codepath.
* bc/hash-algo:
hash: update obsolete reference to SHA1_HEADER
bulk-checkin: abstract SHA-1 usage
csum-file: abstract uses of SHA-1
csum-file: rename sha1file to hashfile
read-cache: abstract away uses of SHA-1
pack-write: switch various SHA-1 values to abstract forms
pack-check: convert various uses of SHA-1 to abstract forms
fast-import: switch various uses of SHA-1 to the_hash_algo
sha1_file: switch uses of SHA-1 to the_hash_algo
builtin/unpack-objects: switch uses of SHA-1 to the_hash_algo
builtin/index-pack: improve hash function abstraction
hash: create union for hash context allocation
hash: move SHA-1 macros to hash.h
Junio C Hamano [Thu, 15 Feb 2018 22:55:46 +0000 (14:55 -0800)]
Merge branch 'nd/ignore-glob-doc-update'
Doc update.
* nd/ignore-glob-doc-update:
gitignore.txt: elaborate shell glob syntax
Junio C Hamano [Thu, 15 Feb 2018 22:55:45 +0000 (14:55 -0800)]
Merge branch 'tg/reset-hard-show-head-with-pretty'
The way "git reset --hard" reports the commit the updated HEAD
points at is made consistent with the way how the commit title is
generated by the other parts of the system. This matters when the
title is spread across physically multiple lines.
* tg/reset-hard-show-head-with-pretty:
reset --hard: make use of the pretty machinery
Junio C Hamano [Thu, 15 Feb 2018 22:55:44 +0000 (14:55 -0800)]
Merge branch 'rs/cocci-strbuf-addf-to-addstr'
* rs/cocci-strbuf-addf-to-addstr:
cocci: simplify check for trivial format strings
Junio C Hamano [Thu, 15 Feb 2018 22:55:44 +0000 (14:55 -0800)]
Merge branch 'nd/trace-index-ops'
* nd/trace-index-ops:
trace: measure where the time is spent in the index-heavy operations
Junio C Hamano [Thu, 15 Feb 2018 22:55:44 +0000 (14:55 -0800)]
Merge branch 'cc/perf-aggregate'
"make perf" enhancement.
* cc/perf-aggregate:
perf/aggregate: sort JSON fields in output
perf/aggregate: add --reponame option
perf/aggregate: add --subsection option
Junio C Hamano [Thu, 15 Feb 2018 22:55:44 +0000 (14:55 -0800)]
Merge branch 'ab/wildmatch-tests'
More tests for wildmatch functions.
* ab/wildmatch-tests:
wildmatch test: mark test as EXPENSIVE_ON_WINDOWS
test-lib: add an EXPENSIVE_ON_WINDOWS prerequisite
wildmatch test: create & test files on disk in addition to in-memory
wildmatch test: perform all tests under all wildmatch() modes
wildmatch test: use test_must_fail, not ! for test-wildmatch
wildmatch test: remove dead fnmatch() test code
wildmatch test: use a paranoia pattern from nul_match()
wildmatch test: don't try to vertically align our output
wildmatch test: use more standard shell style
wildmatch test: indent with tabs, not spaces
Junio C Hamano [Thu, 15 Feb 2018 22:55:43 +0000 (14:55 -0800)]
Merge branch 'po/object-id'
Conversion from uchar[20] to struct object_id continues.
* po/object-id:
sha1_file: rename hash_sha1_file_literally
sha1_file: convert write_loose_object to object_id
sha1_file: convert force_object_loose to object_id
sha1_file: convert write_sha1_file to object_id
notes: convert write_notes_tree to object_id
notes: convert combine_notes_* to object_id
commit: convert commit_tree* to object_id
match-trees: convert splice_tree to object_id
cache: clear whole hash buffer with oidclr
sha1_file: convert hash_sha1_file to object_id
dir: convert struct sha1_stat to use object_id
sha1_file: convert pretend_sha1_file to object_id
Junio C Hamano [Thu, 15 Feb 2018 22:55:43 +0000 (14:55 -0800)]
Merge branch 'sb/pull-rebase-submodule'
"git pull --rebase" did not pass verbosity setting down when
recursing into a submodule.
* sb/pull-rebase-submodule:
builtin/pull: respect verbosity settings in submodules
Junio C Hamano [Thu, 15 Feb 2018 22:55:42 +0000 (14:55 -0800)]
Merge branch 'kg/packed-ref-cache-fix'
Avoid mmapping small files while using packed refs (especially ones
with zero size, which would cause later munmap() to fail).
* kg/packed-ref-cache-fix:
packed_ref_cache: don't use mmap() for small files
load_contents(): don't try to mmap an empty file
packed_ref_iterator_begin(): make optimization more general
find_reference_location(): make function safe for empty snapshots
create_snapshot(): use `xmemdupz()` rather than a strbuf
struct snapshot: store `start` rather than `header_len`
Junio C Hamano [Thu, 15 Feb 2018 22:55:41 +0000 (14:55 -0800)]
Merge branch 'jt/fsck-code-cleanup'
Plug recently introduced leaks in fsck.
* jt/fsck-code-cleanup:
fsck: fix leak when traversing trees
Junio C Hamano [Thu, 15 Feb 2018 22:55:40 +0000 (14:55 -0800)]
Merge branch 'en/merge-recursive-fixes'
* en/merge-recursive-fixes:
merge-recursive: add explanation for src_entry and dst_entry
merge-recursive: fix logic ordering issue
Tighten and correct a few testcases for merging and cherry-picking
Junio C Hamano [Thu, 15 Feb 2018 22:55:40 +0000 (14:55 -0800)]
Merge branch 'jc/worktree-add-short-help'
Error message fix.
* jc/worktree-add-short-help:
worktree: say that "add" takes an arbitrary commit in short-help
Junio C Hamano [Thu, 15 Feb 2018 22:55:40 +0000 (14:55 -0800)]
Merge branch 'ab/sha1dc-build'
Push the submodule version of collision-detecting SHA-1 hash
implementation a bit harder on builders.
* ab/sha1dc-build:
sha1dc_git.h: re-arrange an ifdef chain for a subsequent change
Makefile: under "make dist", include the sha1collisiondetection submodule
Makefile: don't error out under DC_SHA1_EXTERNAL if DC_SHA1_SUBMODULE=auto