Junio C Hamano [Mon, 16 Dec 2019 21:08:39 +0000 (13:08 -0800)]
Merge branch 'hw/doc-in-header'
* hw/doc-in-header:
trace2: move doc to trace2.h
submodule-config: move doc to submodule-config.h
tree-walk: move doc to tree-walk.h
trace: move doc to trace.h
run-command: move doc to run-command.h
parse-options: add link to doc file in parse-options.h
credential: move doc to credential.h
argv-array: move doc to argv-array.h
cache: move doc to cache.h
sigchain: move doc to sigchain.h
pathspec: move doc to pathspec.h
revision: move doc to revision.h
attr: move doc to attr.h
refs: move doc to refs.h
remote: move doc to remote.h and refspec.h
sha1-array: move doc to sha1-array.h
merge: move doc to ll-merge.h
graph: move doc to graph.h and graph.c
dir: move doc to dir.h
diff: move doc to diff.h and diffcore.h
Junio C Hamano [Mon, 16 Dec 2019 21:08:32 +0000 (13:08 -0800)]
Merge branch 'rs/xdiff-ignore-ws-w-func-context'
The "diff" machinery learned not to lose added/removed blank lines
in the context when --ignore-blank-lines and --function-context are
used at the same time.
* rs/xdiff-ignore-ws-w-func-context:
xdiff: unignore changes in function context
Junio C Hamano [Mon, 16 Dec 2019 21:08:32 +0000 (13:08 -0800)]
Merge branch 'dl/rebase-with-autobase'
"git rebase" did not work well when format.useAutoBase
configuration variable is set, which has been corrected.
* dl/rebase-with-autobase:
rebase: fix format.useAutoBase breakage
format-patch: teach --no-base
t4014: use test_config()
format-patch: fix indentation
t3400: demonstrate failure with format.useAutoBase
Junio C Hamano [Mon, 16 Dec 2019 21:08:32 +0000 (13:08 -0800)]
Merge branch 'dl/test-cleanup'
Test cleanup.
* dl/test-cleanup: (26 commits)
t7700: stop losing return codes of git commands
t7700: make references to SHA-1 generic
t7700: replace egrep with grep
t7700: consolidate code into test_has_duplicate_object()
t7700: consolidate code into test_no_missing_in_packs()
t7700: s/test -f/test_path_is_file/
t7700: move keywords onto their own line
t7700: remove spaces after redirect operators
t7700: drop redirections to /dev/null
t7501: stop losing return codes of git commands
t7501: remove spaces after redirect operators
t5703: stop losing return codes of git commands
t5703: simplify one-time-sed generation logic
t5317: use ! grep to check for no matching lines
t5317: stop losing return codes of git commands
t4138: stop losing return codes of git commands
t4015: use test_write_lines()
t4015: stop losing return codes of git commands
t3600: comment on inducing SIGPIPE in `git rm`
t3600: stop losing return codes of git commands
...
Junio C Hamano [Mon, 16 Dec 2019 21:08:31 +0000 (13:08 -0800)]
Merge branch 'cs/store-packfiles-in-hashmap'
In a repository with many packfiles, the cost of the procedure that
avoids registering the same packfile twice was unnecessarily high
by using an inefficient search algorithm, which has been corrected.
* cs/store-packfiles-in-hashmap:
packfile.c: speed up loading lots of packfiles
Junio C Hamano [Mon, 16 Dec 2019 21:08:31 +0000 (13:08 -0800)]
Merge branch 'js/builtin-add-i-cmds'
"git add -i" that is getting rewritten in C has been extended to
cover subcommands other than the "patch".
* js/builtin-add-i-cmds:
built-in add -i: offer the `quit` command
built-in add -i: re-implement the `diff` command
built-in add -i: implement the `patch` command
built-in add -i: re-implement `add-untracked` in C
built-in add -i: re-implement `revert` in C
built-in add -i: implement the `update` command
built-in add -i: prepare for multi-selection commands
built-in add -i: allow filtering the modified files list
add-interactive: make sure to release `rev.prune_data`
Junio C Hamano [Mon, 16 Dec 2019 21:08:31 +0000 (13:08 -0800)]
Merge branch 'dd/time-reentrancy'
Avoid gmtime() and localtime() and prefer their reentrant
counterparts.
* dd/time-reentrancy:
mingw: use {gm,local}time_s as backend for {gm,local}time_r
archive-zip.c: switch to reentrant localtime_r
date.c: switch to reentrant {gm,local}time_r
Junio C Hamano [Mon, 16 Dec 2019 21:08:31 +0000 (13:08 -0800)]
Merge branch 'ag/sequencer-todo-updates'
Reduce unnecessary reading of state variables back from the disk
during sequencer operation.
* ag/sequencer-todo-updates:
sequencer: directly call pick_commits() from complete_action()
rebase: fill `squash_onto' in get_replay_opts()
sequencer: move the code writing total_nr on the disk to a new function
sequencer: update `done_nr' when skipping commands in a todo list
sequencer: update `total_nr' when adding an item to a todo list
ryenus [Sun, 15 Dec 2019 15:12:24 +0000 (15:12 +0000)]
fix-typo: consecutive-word duplications
Correct unintentional duplication(s) of words, such as "the the",
and "can can" etc.
The changes are only applied to cases where it's fixing what is clearly
wrong or prone to misunderstanding, as suggested by the reviewers.
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Denton Liu <liu.denton@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: ryenus <ryenus@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 10 Dec 2019 21:53:00 +0000 (13:53 -0800)]
The fifth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 10 Dec 2019 21:11:46 +0000 (13:11 -0800)]
Merge branch 'ag/sequencer-continue-leakfix'
Leakfix.
* ag/sequencer-continue-leakfix:
sequencer: fix a memory leak in sequencer_continue()
Junio C Hamano [Tue, 10 Dec 2019 21:11:45 +0000 (13:11 -0800)]
Merge branch 'em/test-skip-regex-illseq'
Test portability fix.
* em/test-skip-regex-illseq:
t4210: skip i18n tests that don't work on FreeBSD
Junio C Hamano [Tue, 10 Dec 2019 21:11:45 +0000 (13:11 -0800)]
Merge branch 'hi/gpg-use-check-signature'
Hide lower-level verify_signed-buffer() API as a pure helper to
implement the public check_signature() function, in order to
encourage new callers to use the correct and more strict
validation.
* hi/gpg-use-check-signature:
gpg-interface: prefer check_signature() for GPG verification
Junio C Hamano [Tue, 10 Dec 2019 21:11:45 +0000 (13:11 -0800)]
Merge branch 'bc/t9001-zsh-in-posix-emulation-mode'
Test portability fix.
* bc/t9001-zsh-in-posix-emulation-mode:
t9001: avoid including non-trailing NUL bytes in variables
Junio C Hamano [Tue, 10 Dec 2019 21:11:44 +0000 (13:11 -0800)]
Merge branch 'sg/test-squelch-noise-in-commit-bulk'
Code cleanup.
* sg/test-squelch-noise-in-commit-bulk:
test-lib-functions: suppress a 'git rev-parse' error in 'test_commit_bulk'
Junio C Hamano [Tue, 10 Dec 2019 21:11:44 +0000 (13:11 -0800)]
Merge branch 'jk/perf-wo-git-dot-pm'
Test cleanup.
* jk/perf-wo-git-dot-pm:
t/perf: don't depend on Git.pm
Junio C Hamano [Tue, 10 Dec 2019 21:11:43 +0000 (13:11 -0800)]
Merge branch 'ds/commit-graph-delay-gen-progress'
One kind of progress messages were always given during commit-graph
generation, instead of following the "if it takes more than two
seconds, show progress" pattern, which has been corrected.
* ds/commit-graph-delay-gen-progress:
commit-graph: use start_delayed_progress()
progress: create GIT_PROGRESS_DELAY
Junio C Hamano [Tue, 10 Dec 2019 21:11:43 +0000 (13:11 -0800)]
Merge branch 'jt/clone-recursesub-ref-advise'
The interaction between "git clone --recurse-submodules" and
alternate object store was ill-designed. The documentation and
code have been taught to make more clear recommendations when the
users see failures.
* jt/clone-recursesub-ref-advise:
submodule--helper: advise on fatal alternate error
Doc: explain submodule.alternateErrorStrategy
Junio C Hamano [Tue, 10 Dec 2019 21:11:43 +0000 (13:11 -0800)]
Merge branch 'as/t7812-missing-redirects-fix'
Test fix.
* as/t7812-missing-redirects-fix:
t7812: expect failure for grep -i with invalid UTF-8 data
t7812: add missing redirects
Junio C Hamano [Tue, 10 Dec 2019 21:11:42 +0000 (13:11 -0800)]
Merge branch 'dl/pretty-reference'
"git log" family learned "--pretty=reference" that gives the name
of a commit in the format that is often used to refer to it in log
messages.
* dl/pretty-reference:
SubmittingPatches: use `--pretty=reference`
pretty: implement 'reference' format
pretty: add struct cmt_fmt_map::default_date_mode_type
pretty: provide short date format
t4205: cover `git log --reflog -z` blindspot
pretty.c: inline initalize format_context
revision: make get_revision_mark() return const pointer
completion: complete `tformat:` pretty format
SubmittingPatches: remove dq from commit reference
pretty-formats.txt: use generic terms for hash
SubmittingPatches: use generic terms for hash
Junio C Hamano [Tue, 10 Dec 2019 21:11:42 +0000 (13:11 -0800)]
Merge branch 'dl/submodule-set-url'
"git submodule" learned a subcommand "set-url".
* dl/submodule-set-url:
submodule: teach set-url subcommand
Junio C Hamano [Tue, 10 Dec 2019 21:11:42 +0000 (13:11 -0800)]
Merge branch 'js/mingw-inherit-only-std-handles'
Work around a issue where a FD that is left open when spawning a
child process and is kept open in the child can interfere with the
operation in the parent process on Windows.
* js/mingw-inherit-only-std-handles:
mingw: forbid translating ERROR_SUCCESS to an errno value
mingw: do set `errno` correctly when trying to restrict handle inheritance
mingw: restrict file handle inheritance only on Windows 7 and later
mingw: spawned processes need to inherit only standard handles
mingw: work around incorrect standard handles
mingw: demonstrate that all file handles are inherited by child processes
Junio C Hamano [Tue, 10 Dec 2019 21:11:41 +0000 (13:11 -0800)]
Merge branch 'po/bundle-doc-clonable'
Doc update.
* po/bundle-doc-clonable:
Doc: Bundle file usage
Junio C Hamano [Tue, 10 Dec 2019 21:11:41 +0000 (13:11 -0800)]
Merge branch 'ra/rebase-i-more-options'
"git rebase -i" learned a few options that are known by "git
rebase" proper.
* ra/rebase-i-more-options:
rebase -i: finishing touches to --reset-author-date
rebase: add --reset-author-date
rebase -i: support --ignore-date
sequencer: rename amend_author to author_to_rename
rebase -i: support --committer-date-is-author-date
sequencer: allow callers of read_author_script() to ignore fields
rebase -i: add --ignore-whitespace flag
Junio C Hamano [Tue, 10 Dec 2019 21:11:40 +0000 (13:11 -0800)]
Merge branch 'am/pathspec-from-file'
A few commands learned to take the pathspec from the
standard input or a named file, instead of taking it as the command
line arguments.
* am/pathspec-from-file:
commit: support the --pathspec-from-file option
doc: commit: synchronize <pathspec> description
reset: support the `--pathspec-from-file` option
doc: reset: synchronize <pathspec> description
pathspec: add new function to parse file
parse-options.h: add new options `--pathspec-from-file`, `--pathspec-file-nul`
Junio C Hamano [Tue, 10 Dec 2019 06:17:55 +0000 (22:17 -0800)]
Sync with Git 2.24.1
Junio C Hamano [Fri, 6 Dec 2019 23:10:00 +0000 (15:10 -0800)]
The fourth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 6 Dec 2019 23:09:24 +0000 (15:09 -0800)]
Merge branch 'dl/lore-is-the-archive'
Publicize lore.kernel.org mailing list archive and use URLs
pointing into it to refer to notable messages in the documentation.
* dl/lore-is-the-archive:
doc: replace LKML link with lore.kernel.org
RelNotes: replace Gmane with real Message-IDs
doc: replace MARC links with lore.kernel.org
Junio C Hamano [Fri, 6 Dec 2019 23:09:23 +0000 (15:09 -0800)]
Merge branch 'jk/lore-is-the-archive'
Doc update for the mailing list archiving and nntp service.
* jk/lore-is-the-archive:
doc: replace public-inbox links with lore.kernel.org
doc: recommend lore.kernel.org over public-inbox.org
Junio C Hamano [Fri, 6 Dec 2019 23:09:23 +0000 (15:09 -0800)]
Merge branch 'tg/perf-remove-stale-result'
PerfTest fix to avoid stale result mixed up with the latest round
of test results.
* tg/perf-remove-stale-result:
perf-lib: use a single filename for all measurement types
Junio C Hamano [Fri, 6 Dec 2019 23:09:22 +0000 (15:09 -0800)]
Merge branch 'jk/send-pack-check-negative-with-quick'
Performance tweak on "git push" into a repository with many refs
that point at objects we have never heard of.
* jk/send-pack-check-negative-with-quick:
send-pack: use OBJECT_INFO_QUICK to check negative objects
Junio C Hamano [Fri, 6 Dec 2019 23:09:22 +0000 (15:09 -0800)]
Merge branch 'hi/grep-do-not-return-void'
Code cleanup.
* hi/grep-do-not-return-void:
grep: don't return an expression from pcre2_free()
Junio C Hamano [Fri, 6 Dec 2019 23:09:22 +0000 (15:09 -0800)]
Merge branch 'rs/use-skip-prefix-more'
Code cleanup.
* rs/use-skip-prefix-more:
name-rev: use skip_prefix() instead of starts_with()
push: use skip_prefix() instead of starts_with()
shell: use skip_prefix() instead of starts_with()
fmt-merge-msg: use skip_prefix() instead of starts_with()
fetch: use skip_prefix() instead of starts_with()
Junio C Hamano [Fri, 6 Dec 2019 23:09:22 +0000 (15:09 -0800)]
Merge branch 'rs/simplify-prepare-cmd'
Code cleanup.
* rs/simplify-prepare-cmd:
run-command: use prepare_git_cmd() in prepare_cmd()
Junio C Hamano [Fri, 6 Dec 2019 23:09:22 +0000 (15:09 -0800)]
Merge branch 'rs/test-cleanup'
Test cleanup.
* rs/test-cleanup:
t7811: don't create unused file
t9300: don't create unused file
test: use test_must_be_empty F instead of test_cmp empty F
test: use test_must_be_empty F instead of test -z $(cat F)
t1400: use test_must_be_empty
t1410: use test_line_count
t1512: use test_line_count
Junio C Hamano [Fri, 6 Dec 2019 23:09:21 +0000 (15:09 -0800)]
Merge branch 'sg/assume-no-todo-update-in-cherry-pick'
While running "revert" or "cherry-pick --edit" for multiple
commits, a recent regression incorrectly detected "nothing to
commit, working tree clean", instead of replaying the commits,
which has been corrected.
* sg/assume-no-todo-update-in-cherry-pick:
sequencer: don't re-read todo for revert and cherry-pick
Junio C Hamano [Fri, 6 Dec 2019 23:09:21 +0000 (15:09 -0800)]
Merge branch 'sg/osx-force-gcc-9'
TravisCI update.
* sg/osx-force-gcc-9:
ci: build Git with GCC 9 in the 'osx-gcc' build job
Johannes Schindelin [Wed, 4 Dec 2019 22:10:12 +0000 (23:10 +0100)]
Git 2.24.1
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 22:09:11 +0000 (23:09 +0100)]
Sync with 2.23.1
* maint-2.23: (44 commits)
Git 2.23.1
Git 2.22.2
Git 2.21.1
mingw: sh arguments need quoting in more circumstances
mingw: fix quoting of empty arguments for `sh`
mingw: use MSYS2 quoting even when spawning shell scripts
mingw: detect when MSYS2's sh is to be spawned more robustly
t7415: drop v2.20.x-specific work-around
Git 2.20.2
t7415: adjust test for dubiously-nested submodule gitdirs for v2.20.x
Git 2.19.3
Git 2.18.2
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
...
Johannes Schindelin [Wed, 4 Dec 2019 22:07:46 +0000 (23:07 +0100)]
Git 2.23.1
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 22:06:31 +0000 (23:06 +0100)]
Sync with 2.22.2
* maint-2.22: (43 commits)
Git 2.22.2
Git 2.21.1
mingw: sh arguments need quoting in more circumstances
mingw: fix quoting of empty arguments for `sh`
mingw: use MSYS2 quoting even when spawning shell scripts
mingw: detect when MSYS2's sh is to be spawned more robustly
t7415: drop v2.20.x-specific work-around
Git 2.20.2
t7415: adjust test for dubiously-nested submodule gitdirs for v2.20.x
Git 2.19.3
Git 2.18.2
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
...
Johannes Schindelin [Wed, 4 Dec 2019 22:05:10 +0000 (23:05 +0100)]
Git 2.22.2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 22:03:16 +0000 (23:03 +0100)]
Sync with 2.21.1
* maint-2.21: (42 commits)
Git 2.21.1
mingw: sh arguments need quoting in more circumstances
mingw: fix quoting of empty arguments for `sh`
mingw: use MSYS2 quoting even when spawning shell scripts
mingw: detect when MSYS2's sh is to be spawned more robustly
t7415: drop v2.20.x-specific work-around
Git 2.20.2
t7415: adjust test for dubiously-nested submodule gitdirs for v2.20.x
Git 2.19.3
Git 2.18.2
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
...
Johannes Schindelin [Wed, 4 Dec 2019 22:01:50 +0000 (23:01 +0100)]
Git 2.21.1
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Mon, 16 Sep 2019 11:26:40 +0000 (13:26 +0200)]
Merge branch 'fix-msys2-quoting-bugs'
These patches fix several bugs in quoting arguments when spawning shell
scripts on Windows.
Note: these bugs are Windows-only, as we have to construct a command
line for the process-to-spawn, unlike Linux/macOS, where `execv()`
accepts an already-split command line.
Furthermore, these fixes were not included in the CVE-2019-1350 part of
v2.14.6 because the Windows-specific quoting when spawning shell scripts
was contributed from Git for Windows into Git only in the v2.21.x era.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Thu, 19 Sep 2019 21:43:03 +0000 (23:43 +0200)]
mingw: sh arguments need quoting in more circumstances
Previously, we failed to quote characters such as '*', '(' and the
likes. Let's fix this.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 21:47:25 +0000 (22:47 +0100)]
t7415: drop v2.20.x-specific work-around
This reverts the work-around that was introduced just for the v2.20.x
release train in "t7415: adjust test for dubiously-nested submodule
gitdirs for v2.20.x"; It is not necessary for v2.21.x.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Thu, 19 Sep 2019 21:38:33 +0000 (23:38 +0200)]
mingw: fix quoting of empty arguments for `sh`
When constructing command-lines to spawn processes, it is an unfortunate
but necessary decision to quote arguments differently: MSYS2 has
different dequoting rules (inherited from Cygwin) than the rest of
Windows.
To accommodate that, Git's Windows compatibility layer has two separate
quoting helpers, one for MSYS2 (which it uses exclusively when spawning
`sh`) and the other for regular Windows executables.
The MSYS2 one had an unfortunate bug where a `,` somehow slipped in,
instead of the `;`. As a consequence, empty arguments would not be
enclosed in a pair of double quotes, but the closing double quote was
skipped.
Let's fix this.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Thu, 19 Sep 2019 15:05:45 +0000 (17:05 +0200)]
mingw: use MSYS2 quoting even when spawning shell scripts
At the point where `mingw_spawn_fd()` is called, we already have a full
path to the script interpreter in that scenario, and we pass it in as
the executable to run, while the `argv` reflect what the script should
receive as command-line.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Thu, 19 Sep 2019 15:05:21 +0000 (17:05 +0200)]
mingw: detect when MSYS2's sh is to be spawned more robustly
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 21:46:37 +0000 (22:46 +0100)]
Sync with 2.20.2
* maint-2.20: (36 commits)
Git 2.20.2
t7415: adjust test for dubiously-nested submodule gitdirs for v2.20.x
Git 2.19.3
Git 2.18.2
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
...
Johannes Schindelin [Wed, 4 Dec 2019 21:33:15 +0000 (22:33 +0100)]
Git 2.20.2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Jonathan Nieder [Thu, 5 Dec 2019 09:28:28 +0000 (01:28 -0800)]
submodule: defend against submodule.update = !command in .gitmodules
In v2.15.4, we started to reject `submodule.update` settings in
`.gitmodules`. Let's raise a BUG if it somehow still made it through
from anywhere but the Git config.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 09:06:08 +0000 (10:06 +0100)]
t7415: adjust test for dubiously-nested submodule gitdirs for v2.20.x
In v2.20.x, Git clones submodules recursively by first creating the
submodules' gitdirs and _then_ "updating" the submodules. This can lead
to the situation where the clone path is taken because the directory
(while it exists already) is not a git directory, but then the clone
fails because that gitdir is unexpectedly already a directory.
This _also_ works around the vulnerability that was fixed in "Disallow
dubiously-nested submodule git directories", but it produces a different
error message than the one expected by the test case, therefore we
adjust the test case accordingly.
Note: as the two submodules "race each other", there are actually two
possible error messages, therefore we have to teach the test case to
expect _two_ possible (and good) outcomes in addition to the one it
expected before.
Note: this workaround is only necessary for the v2.20.x release train;
The behavior changed again in v2.21.x so that the original test case's
expectations are met again.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 21:31:10 +0000 (22:31 +0100)]
Sync with 2.19.3
* maint-2.19: (34 commits)
Git 2.19.3
Git 2.18.2
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
protect_ntfs: turn on NTFS protection by default
path: also guard `.gitmodules` against NTFS Alternate Data Streams
...
Johannes Schindelin [Wed, 4 Dec 2019 21:29:33 +0000 (22:29 +0100)]
Git 2.19.3
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 21:27:04 +0000 (22:27 +0100)]
Sync with 2.18.2
* maint-2.18: (33 commits)
Git 2.18.2
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
protect_ntfs: turn on NTFS protection by default
path: also guard `.gitmodules` against NTFS Alternate Data Streams
is_ntfs_dotgit(): speed it up
...
Johannes Schindelin [Wed, 4 Dec 2019 21:22:52 +0000 (22:22 +0100)]
Git 2.18.2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 21:21:20 +0000 (22:21 +0100)]
Sync with 2.17.3
* maint-2.17: (32 commits)
Git 2.17.3
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
protect_ntfs: turn on NTFS protection by default
path: also guard `.gitmodules` against NTFS Alternate Data Streams
is_ntfs_dotgit(): speed it up
mingw: disallow backslash characters in tree objects' file names
...
Johannes Schindelin [Wed, 4 Dec 2019 21:13:04 +0000 (22:13 +0100)]
Git 2.17.3
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Jonathan Nieder [Thu, 5 Dec 2019 09:30:43 +0000 (01:30 -0800)]
fsck: reject submodule.update = !command in .gitmodules
This allows hosting providers to detect whether they are being used
to attack users using malicious 'update = !command' settings in
.gitmodules.
Since
ac1fbbda2013 (submodule: do not copy unknown update mode from
.gitmodules, 2013-12-02), in normal cases such settings have been
treated as 'update = none', so forbidding them should not produce any
collateral damage to legitimate uses. A quick search does not reveal
any repositories making use of this construct, either.
Reported-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 20:52:10 +0000 (21:52 +0100)]
Sync with 2.16.6
* maint-2.16: (31 commits)
Git 2.16.6
test-drop-caches: use `has_dos_drive_prefix()`
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
protect_ntfs: turn on NTFS protection by default
path: also guard `.gitmodules` against NTFS Alternate Data Streams
is_ntfs_dotgit(): speed it up
mingw: disallow backslash characters in tree objects' file names
path: safeguard `.git` against NTFS Alternate Streams Accesses
...
Johannes Schindelin [Wed, 4 Dec 2019 20:45:07 +0000 (21:45 +0100)]
Git 2.16.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 20:40:01 +0000 (21:40 +0100)]
test-drop-caches: use `has_dos_drive_prefix()`
This is a companion patch to 'mingw: handle `subst`-ed "DOS drives"':
use the DOS drive prefix handling that is already provided by
`compat/mingw.c` (and which just learned to handle non-alphabetical
"drive letters").
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 20:38:25 +0000 (21:38 +0100)]
Sync with 2.15.4
* maint-2.15: (29 commits)
Git 2.15.4
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
protect_ntfs: turn on NTFS protection by default
path: also guard `.gitmodules` against NTFS Alternate Data Streams
is_ntfs_dotgit(): speed it up
mingw: disallow backslash characters in tree objects' file names
path: safeguard `.git` against NTFS Alternate Streams Accesses
clone --recurse-submodules: prevent name squatting on Windows
is_ntfs_dotgit(): only verify the leading segment
...
Johannes Schindelin [Wed, 4 Dec 2019 20:33:29 +0000 (21:33 +0100)]
Git 2.15.4
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Jonathan Nieder [Thu, 5 Dec 2019 09:28:28 +0000 (01:28 -0800)]
submodule: reject submodule.update = !command in .gitmodules
Since
ac1fbbda2013 (submodule: do not copy unknown update mode from
.gitmodules, 2013-12-02), Git has been careful to avoid copying
[submodule "foo"]
update = !run an arbitrary scary command
from .gitmodules to a repository's local config, copying in the
setting 'update = none' instead. The gitmodules(5) manpage documents
the intention:
The !command form is intentionally ignored here for security
reasons
Unfortunately, starting with v2.20.0-rc0 (which integrated
ee69b2a9
(submodule--helper: introduce new update-module-mode helper,
2018-08-13, first released in v2.20.0-rc0)), there are scenarios where
we *don't* ignore it: if the config store contains no
submodule.foo.update setting, the submodule-config API falls back to
reading .gitmodules and the repository-supplied !command gets run
after all.
This was part of a general change over time in submodule support to
read more directly from .gitmodules, since unlike .git/config it
allows a project to change values between branches and over time
(while still allowing .git/config to override things). But it was
never intended to apply to this kind of dangerous configuration.
The behavior change was not advertised in
ee69b2a9's commit message
and was missed in review.
Let's take the opportunity to make the protection more robust, even in
Git versions that are technically not affected: instead of quietly
converting 'update = !command' to 'update = none', noisily treat it as
an error. Allowing the setting but treating it as meaning something
else was just confusing; users are better served by seeing the error
sooner. Forbidding the construct makes the semantics simpler and
means we can check for it in fsck (in a separate patch).
As a result, the submodule-config API cannot read this value from
.gitmodules under any circumstance, and we can declare with confidence
For security reasons, the '!command' form is not accepted
here.
Reported-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Johannes Schindelin [Wed, 4 Dec 2019 20:26:31 +0000 (21:26 +0100)]
Sync with 2.14.6
* maint-2.14: (28 commits)
Git 2.14.6
mingw: handle `subst`-ed "DOS drives"
mingw: refuse to access paths with trailing spaces or periods
mingw: refuse to access paths with illegal characters
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
quote-stress-test: offer to test quoting arguments for MSYS2 sh
t6130/t9350: prepare for stringent Win32 path validation
quote-stress-test: allow skipping some trials
quote-stress-test: accept arguments to test via the command-line
tests: add a helper to stress test argument quoting
mingw: fix quoting of arguments
Disallow dubiously-nested submodule git directories
protect_ntfs: turn on NTFS protection by default
path: also guard `.gitmodules` against NTFS Alternate Data Streams
is_ntfs_dotgit(): speed it up
mingw: disallow backslash characters in tree objects' file names
path: safeguard `.git` against NTFS Alternate Streams Accesses
clone --recurse-submodules: prevent name squatting on Windows
is_ntfs_dotgit(): only verify the leading segment
test-path-utils: offer to run a protectNTFS/protectHFS benchmark
...
Johannes Schindelin [Wed, 4 Dec 2019 18:58:46 +0000 (19:58 +0100)]
Git 2.14.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Junio C Hamano [Thu, 5 Dec 2019 20:43:59 +0000 (12:43 -0800)]
The third batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 5 Dec 2019 20:52:49 +0000 (12:52 -0800)]
Merge branch 'js/pkt-line-h-typofix'
Typofix.
* js/pkt-line-h-typofix:
pkt-line: fix a typo
Junio C Hamano [Thu, 5 Dec 2019 20:52:48 +0000 (12:52 -0800)]
Merge branch 'us/unpack-trees-fsmonitor'
Users of oneway_merge() (like "reset --hard") learned to take
advantage of fsmonitor to avoid unnecessary lstat(2) calls.
* us/unpack-trees-fsmonitor:
unpack-trees: skip stat on fsmonitor-valid files
Junio C Hamano [Thu, 5 Dec 2019 20:52:48 +0000 (12:52 -0800)]
Merge branch 'sg/test-bool-env'
Recently we have declared that GIT_TEST_* variables take the
usual boolean values (it used to be that some used "non-empty
means true" and taking GIT_TEST_VAR=YesPlease as true); make
sure we notice and fail when non-bool strings are given to
these variables.
* sg/test-bool-env:
t5608-clone-2gb.sh: turn GIT_TEST_CLONE_2GB into a bool
tests: add 'test_bool_env' to catch non-bool GIT_TEST_* values
Junio C Hamano [Thu, 5 Dec 2019 20:52:48 +0000 (12:52 -0800)]
Merge branch 'mh/clear-topo-walk-upon-reset'
The revision walking machinery uses resources like per-object flag
bits that need to be reset before a new iteration of walking
begins, but the resources related to topological walk were not
cleared correctly, which has been corrected.
* mh/clear-topo-walk-upon-reset:
revision: free topo_walk_info before creating a new one in init_topo_walk
revision: clear the topo-walk flags in reset_revision_walk
Junio C Hamano [Thu, 5 Dec 2019 20:52:47 +0000 (12:52 -0800)]
Merge branch 'hv/assume-priumax-is-available-anywhere'
We have had compatibility fallback macro definitions for "PRIuMAX",
"PRIu32", etc. but did not for "PRIdMAX", while the code used the
last one apparently without any hiccup reported recently. The
fallback macro definitions for these <inttypes.h> macros that must
appear in C99 systems have been removed.
* hv/assume-priumax-is-available-anywhere:
git-compat-util.h: drop the `PRIuMAX` and other fallback definitions
Junio C Hamano [Thu, 5 Dec 2019 20:52:47 +0000 (12:52 -0800)]
Merge branch 'mg/submodule-status-from-a-subdirectory'
"git submodule status" that is run from a subdirectory of the
superproject did not work well, which has been corrected.
* mg/submodule-status-from-a-subdirectory:
submodule: fix 'submodule status' when called from a subdirectory
Junio C Hamano [Thu, 5 Dec 2019 20:52:47 +0000 (12:52 -0800)]
Merge branch 'dl/t5520-cleanup'
Test cleanup.
* dl/t5520-cleanup:
t5520: replace `! git` with `test_must_fail git`
t5520: remove redundant lines in test cases
t5520: replace $(cat ...) comparison with test_cmp
t5520: don't put git in upstream of pipe
t5520: test single-line files by git with test_cmp
t5520: use test_cmp_rev where possible
t5520: replace test -{n,z} with test-lib functions
t5520: use test_line_count where possible
t5520: remove spaces after redirect operator
t5520: replace test -f with test-lib functions
t5520: let sed open its own input
t5520: use sq for test case names
t5520: improve test style
t: teach test_cmp_rev to accept ! for not-equals
t0000: test multiple local assignment
Junio C Hamano [Thu, 5 Dec 2019 20:52:47 +0000 (12:52 -0800)]
Merge branch 'nl/reset-patch-takes-a-tree'
"git reset --patch $object" without any pathspec should allow a
tree object to be given, but incorrectly required a committish,
which has been corrected.
* nl/reset-patch-takes-a-tree:
reset: parse rev as tree-ish in patch mode
Junio C Hamano [Thu, 5 Dec 2019 20:52:47 +0000 (12:52 -0800)]
Merge branch 'mg/doc-submodule-status-cached'
"git submodule status" and "git submodule status --cached" show
different things, but the documentation did not cover them
correctly, which has been corrected.
* mg/doc-submodule-status-cached:
doc: document 'git submodule status --cached'
Junio C Hamano [Thu, 5 Dec 2019 20:52:46 +0000 (12:52 -0800)]
Merge branch 'js/git-svn-use-rebase-merges'
Prepare further for "rebase --preserve-merges" deprecation.
* js/git-svn-use-rebase-merges:
git svn: stop using `rebase --preserve-merges`
Junio C Hamano [Thu, 5 Dec 2019 20:52:46 +0000 (12:52 -0800)]
Merge branch 'hi/gpg-optional-pkfp-fix'
The code to parse GPG output used to assume incorrectly that the
finterprint for the primary key would always be present for a valid
signature, which has been corrected.
* hi/gpg-optional-pkfp-fix:
gpg-interface: limit search for primary key fingerprint
gpg-interface: refactor the free-and-xmemdupz pattern
Junio C Hamano [Thu, 5 Dec 2019 20:52:46 +0000 (12:52 -0800)]
Merge branch 'pw/sequencer-compare-with-right-parent-to-check-empty-commits'
The sequencer machinery compared the HEAD and the state it is
attempting to commit to decide if the result would be a no-op
commit, even when amending a commit, which was incorrect, and
has been corrected.
* pw/sequencer-compare-with-right-parent-to-check-empty-commits:
sequencer: fix empty commit check when amending
Junio C Hamano [Thu, 5 Dec 2019 20:52:45 +0000 (12:52 -0800)]
Merge branch 'jk/fail-show-toplevel-outside-working-tree'
"git rev-parse --show-toplevel" run outside of any working tree did
not error out, which has been corrected.
* jk/fail-show-toplevel-outside-working-tree:
rev-parse: make --show-toplevel without a worktree an error
Junio C Hamano [Thu, 5 Dec 2019 20:52:45 +0000 (12:52 -0800)]
Merge branch 'sg/unpack-progress-throughput'
"git unpack-objects" used to show progress based only on the number
of received and unpacked objects, which stalled when it has to
handle an unusually large object. It now shows the throughput as
well.
* sg/unpack-progress-throughput:
builtin/unpack-objects.c: show throughput progress
Junio C Hamano [Thu, 5 Dec 2019 20:52:45 +0000 (12:52 -0800)]
Merge branch 'pb/submodule-update-fetches'
Doc update.
* pb/submodule-update-fetches:
doc: mention that 'git submodule update' fetches missing commits
Junio C Hamano [Thu, 5 Dec 2019 20:52:44 +0000 (12:52 -0800)]
Merge branch 'jc/azure-ci-osx-fix-fix'
CI jobs for macOS has been made less chatty when updating perforce
package used during testing.
* jc/azure-ci-osx-fix-fix:
ci(osx): update homebrew-cask repository with less noise
Junio C Hamano [Thu, 5 Dec 2019 20:52:44 +0000 (12:52 -0800)]
Merge branch 'dl/range-diff-with-notes'
"git range-diff" learned to take the "--notes=<ref>" and the
"--no-notes" options to control the commit notes included in the
log message that gets compared.
* dl/range-diff-with-notes:
format-patch: pass notes configuration to range-diff
range-diff: pass through --notes to `git log`
range-diff: output `## Notes ##` header
t3206: range-diff compares logs with commit notes
t3206: s/expected/expect/
t3206: disable parameter substitution in heredoc
t3206: remove spaces after redirect operators
pretty-options.txt: --notes accepts a ref instead of treeish
rev-list-options.txt: remove reference to --show-notes
argv-array: add space after `while`
Junio C Hamano [Thu, 5 Dec 2019 20:52:44 +0000 (12:52 -0800)]
Merge branch 'jh/userdiff-python-async'
The userdiff machinery has been taught that "async def" is another
way to begin a "function" in Python.
* jh/userdiff-python-async:
userdiff: support Python async functions
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'ec/fetch-mark-common-refs-trace2'
Trace2 annotation.
* ec/fetch-mark-common-refs-trace2:
fetch: add trace2 instrumentation
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'dd/rebase-merge-reserves-onto-label'
The logic to avoid duplicate label names generated by "git rebase
--rebase-merges" forgot that the machinery itself uses "onto" as a
label name, which must be avoided by auto-generated labels, which
has been corrected.
* dd/rebase-merge-reserves-onto-label:
sequencer: handle rebase-merges for "onto" message
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'js/builtin-add-i'
The beginning of rewriting "git add -i" in C.
* js/builtin-add-i:
built-in add -i: implement the `help` command
built-in add -i: use color in the main loop
built-in add -i: support `?` (prompt help)
built-in add -i: show unique prefixes of the commands
built-in add -i: implement the main loop
built-in add -i: color the header in the `status` command
built-in add -i: implement the `status` command
diff: export diffstat interface
Start to implement a built-in version of `git add --interactive`
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'js/rebase-r-safer-label'
A label used in the todo list that are generated by "git rebase
--rebase-merges" is used as a part of a refname; the logic to come
up with the label has been tightened to avoid names that cannot be
used as such.
* js/rebase-r-safer-label:
rebase -r: let `label` generate safer labels
rebase-merges: move labels' whitespace mangling into `label_oid()`
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'ep/guard-kset-tar-headers'
Code clean-up.
* ep/guard-kset-tar-headers:
kset.h, tar.h: add missing header guard to prevent multiple inclusion
René Scharfe [Thu, 5 Dec 2019 16:15:31 +0000 (17:15 +0100)]
xdiff: unignore changes in function context
Changes involving only blank lines are hidden with --ignore-blank-lines,
unless they appear in the context lines of other changes. This is
handled by xdl_get_hunk() for context added by --inter-hunk-context, -u
and -U.
Function context for -W and --function-context added by xdl_emit_diff()
doesn't pay attention to such ignored changes; it relies fully on
xdl_get_hunk() and shows just the post-image of ignored changes
appearing in function context. That's inconsistent and confusing.
Improve the result of using --ignore-blank-lines and --function-context
together by fully showing ignored changes if they happen to fall within
function context.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Mon, 16 Sep 2019 11:26:40 +0000 (13:26 +0200)]
Merge branch 'win32-accommodate-funny-drive-names'
While the only permitted drive letters for physical drives on Windows
are letters of the US-English alphabet, this restriction does not apply
to virtual drives assigned via `subst <letter>: <path>`.
To prevent targeted attacks against systems where "funny" drive letters
such as `1` or `!` are assigned, let's handle them as regular drive
letters on Windows.
This fixes CVE-2019-1351.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Mon, 16 Sep 2019 11:26:40 +0000 (13:26 +0200)]
Merge branch 'win32-filenames-cannot-have-trailing-spaces-or-periods'
On Windows, filenames cannot have trailing spaces or periods, when
opening such paths, they are stripped automatically. Read: you can open
the file `README` via the file name `README . . .`. This ambiguity can
be used in combination with other security bugs to cause e.g. remote
code execution during recursive clones. This patch series fixes that.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Mon, 16 Sep 2019 11:26:40 +0000 (13:26 +0200)]
Merge branch 'fix-mingw-quoting-bug'
This patch fixes a vulnerability in the Windows-specific code where a
submodule names ending in a backslash were quoted incorrectly, and that
bug could be abused to insert command-line parameters e.g. to `ssh` in a
recursive clone.
Note: this bug is Windows-only, as we have to construct a command line
for the process-to-spawn, unlike Linux/macOS, where `execv()` accepts an
already-split command line.
While at it, other quoting issues are fixed as well.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 2 Oct 2019 11:08:45 +0000 (13:08 +0200)]
Merge branch 'dubiously-nested-submodules'
Recursive clones are currently affected by a vulnerability that is
caused by too-lax validation of submodule names.
This topic branch fixes that.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Mon, 16 Sep 2019 11:26:40 +0000 (13:26 +0200)]
Merge branch 'turn-on-protectntfs-by-default'
This patch series makes it safe to use Git on Windows drives, even if
running on a mounted network share or within the Windows Subsystem for
Linux (WSL).
This topic branch addresses CVE-2019-1353.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Thu, 5 Sep 2019 22:09:10 +0000 (00:09 +0200)]
mingw: handle `subst`-ed "DOS drives"
Over a decade ago, in
25fe217b86c (Windows: Treat Windows style path
names., 2008-03-05), Git was taught to handle absolute Windows paths,
i.e. paths that start with a drive letter and a colon.
Unbeknownst to us, while drive letters of physical drives are limited to
letters of the English alphabet, there is a way to assign virtual drive
letters to arbitrary directories, via the `subst` command, which is
_not_ limited to English letters.
It is therefore possible to have absolute Windows paths of the form
`1:\what\the\hex.txt`. Even "better": pretty much arbitrary Unicode
letters can also be used, e.g. `ä:\tschibät.sch`.
While it can be sensibly argued that users who set up such funny drive
letters really seek adverse consequences, the Windows Operating System
is known to be a platform where many users are at the mercy of
administrators who have their very own idea of what constitutes a
reasonable setup.
Therefore, let's just make sure that such funny paths are still
considered absolute paths by Git, on Windows.
In addition to Unicode characters, pretty much any character is a valid
drive letter, as far as `subst` is concerned, even `:` and `"` or even a
space character. While it is probably the opposite of smart to use them,
let's safeguard `is_dos_drive_prefix()` against all of them.
Note: `[::1]:repo` is a valid URL, but not a valid path on Windows.
As `[` is now considered a valid drive letter, we need to be very
careful to avoid misinterpreting such a string as valid local path in
`url_is_local_not_ssh()`. To do that, we use the just-introduced
function `is_valid_path()` (which will label the string as invalid file
name because of the colon characters).
This fixes CVE-2019-1351.
Reported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>