Commit Graph

105648 Commits

Author SHA1 Message Date
Johannes Schindelin
921e1fa3cc built-in add -p: prepare for patch modes other than "stage"
The Perl script backing `git add -p` is used not only for that command,
but also for `git stash -p`, `git reset -p` and `git checkout -p`.

In preparation for teaching the C version of `git add -p` to support
also the latter commands, let's abstract away what is "stage" specific
into a dedicated data structure describing the differences between the
patch modes.

Finally, please note that the Perl version tries to make sure that the
diffs are only generated for the modified files. This is not actually
necessary, as the calls to Git's diff machinery already perform that
work, and perform it well. This makes it unnecessary to port the
`FILTER` field of the `%patch_modes` struct, as well as the
`get_diff_reference()` function.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2020-01-03 20:45:24 +01:00
Johannes Schindelin
8857bb52ec Start the merging-rebase to v2.25.0-rc1
This commit starts the rebase of 3ee5f1f885 to d5b9efb81ba
2020-01-03 20:45:22 +01:00
Johannes Schindelin
8fc9b8676b Merge pull request #2437 from dscho/only-error-on-backslash-in-index
Disallow writing, but not fetching commits with file names containing backslashes
2020-01-03 20:41:38 +01:00
Johannes Schindelin
0c54f76894 Merge pull request #2449 from dscho/mingw-getcwd-and-symlinks
Do resolve symlinks in `getcwd()`
2020-01-03 20:34:06 +01:00
Junio C Hamano
8679ef24ed Git 2.25-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-01-02 12:38:30 -08:00
Junio C Hamano
a82027e9e6 Merge branch 'js/use-test-tool-on-path'
Test fix.

* js/use-test-tool-on-path:
  t3008: find test-tool through path lookup
2020-01-02 12:38:30 -08:00
Junio C Hamano
13432fc6dd Merge branch 'js/mingw-reserved-filenames'
Forbid pathnames that the platform's filesystem cannot represent on
MinGW.

* js/mingw-reserved-filenames:
  mingw: refuse paths containing reserved names
  mingw: short-circuit the conversion of `/dev/null` to UTF-16
2020-01-02 12:38:30 -08:00
Junio C Hamano
e0e1ac5db0 Merge branch 'en/rebase-signoff-fix'
"git rebase --signoff" stopped working when the command was written
in C, which has been corrected.

* en/rebase-signoff-fix:
  rebase: fix saving of --signoff state for am-based rebases
2020-01-02 12:38:30 -08:00
Junio C Hamano
b76a244c9d Merge branch 'em/freebsd-cirrus-ci'
* em/freebsd-cirrus-ci:
  CI: add FreeBSD CI support via Cirrus-CI
2020-01-02 12:38:29 -08:00
Junio C Hamano
bc855232bc Merge branch 'bk/p4-misc-usability'
Miscellaneous small UX improvements on "git-p4".

* bk/p4-misc-usability:
  git-p4: show detailed help when parsing options fail
  git-p4: yes/no prompts should sanitize user text
2020-01-02 12:38:29 -08:00
Johannes Schindelin
8afef17373 mingw: do resolve symlinks in getcwd()
As pointed out in https://github.com/git-for-windows/git/issues/1676,
the `git rev-parse --is-inside-work-tree` command currently fails when
the current directory's path contains symbolic links.

The underlying reason for this bug is that `getcwd()` is supposed to
resolve symbolic links, but our `mingw_getcwd()` implementation did not.

We do have all the building blocks for that, though: the
`GetFinalPathByHandleW()` function will resolve symbolic links. However,
we only called that function if `GetLongPathNameW()` failed, for
historical reasons: the latter function was supported for a long time,
but the former API function was introduced only with Windows Vista, and
we used to support also Windows XP. With that support having been
dropped, we are free to call the symbolic link-resolving function right
away.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2020-01-01 21:07:22 +01:00
Johannes Sixt
20a67e8ce9 t3008: find test-tool through path lookup
Do not use $GIT_BUILD_DIR without quotes; it may contain spaces and be
split into fields. But it is not necessary to access test-tool with an
absolute path in the first place as it can be found via path lookup.
Remove the explicit path.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-12-27 14:15:01 -08:00
Johannes Schindelin
2249a76fa1 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
v2.25.0-rc0.windows.1
2019-12-27 09:26:30 +01:00
Johannes Schindelin
53f13ea32a Merge pull request #1354 from dscho/phase-out-show-ignored-directory-gracefully
Phase out `--show-ignored-directory` gracefully
2019-12-27 09:26:29 +01:00
Johannes Schindelin
9551b5a0be Merge branch 'status-no-lock-index'
This branch allows third-party tools to call `git status
--no-lock-index` to avoid lock contention with the interactive Git usage
of the actual human user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:28 +01:00
Johannes Schindelin
9dd2877d32 Merge pull request #1170 from dscho/mingw-kill-process
Handle Ctrl+C in Git Bash nicely

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:28 +01:00
Johannes Schindelin
aa2ed60cae Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:27 +01:00
Johannes Schindelin
94cde609ec Merge pull request #1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2019-12-27 09:26:26 +01:00
Johannes Schindelin
c229d4d3fa Merge 'docker-volumes-are-no-symlinks'
This was pull request #1645 from ZCube/master

Support windows container.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:26 +01:00
Johannes Schindelin
5d455f453f Merge branch 'kblees/kb/symlinks' 2019-12-27 09:26:25 +01:00
Johannes Schindelin
38159a0ad6 Merge branch 'msys2' 2019-12-27 09:26:25 +01:00
Johannes Schindelin
baa71f4be3 Merge branch 'long-paths' 2019-12-27 09:26:24 +01:00
Johannes Schindelin
6021631447 Merge branch 'dont-clean-junctions-fscache'
We already avoid traversing NTFS junction points in `git clean -dfx`.
With this topic branch, we do that when the FSCache is enabled, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:23 +01:00
Derrick Stolee
82dc309682 Merge branch 'fscache-and-sparse-checkout'
When updating the skip-worktree bits in the index to align with new
values in a sparse-checkout file, Git scans the entire working
directory with lstat() calls. In a sparse-checkout, many of these
lstat() calls are for paths that do not exist.

Enable the fscache feature during this scan.

In a local test of a repo with ~2.2 million paths, updating the index
with `git read-tree -m -u HEAD` with a sparse-checkout file containing
only `/.gitattributes` improved from 2-3 minutes to 15-20 seconds.

More work could be done to stop running lstat() calls when recursing
into directories that are known to not exist.
2019-12-27 09:26:23 +01:00
Johannes Schindelin
ee695f37d4 Merge pull request #1937 from benpeart/fscache-NtQueryDirectoryFile-gfw
fscache: teach fscache to use NtQueryDirectoryFile
2019-12-27 09:26:22 +01:00
Johannes Schindelin
89d6ed6119 Merge pull request #1934 from benpeart/fscache-thread-safe-enable-gfw
fscache: make fscache_enable() thread safe
2019-12-27 09:26:22 +01:00
Johannes Schindelin
65d07ba525 Merge remote-tracking branch 'benpeart/fscache-per-thread-gfw'
This brings substantial wins in performance because the FSCache is now
per-thread, being merged to the primary thread only at the end, so we do
not have to lock (except while merging).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:22 +01:00
Johannes Schindelin
8a8eac385f Merge pull request #1910 from benpeart/fscache_statistics-gfw
fscache: add fscache hit statistics
2019-12-27 09:26:21 +01:00
Johannes Schindelin
73ee893b1e Merge pull request #1914 from benpeart/free-fscache-after-add-gfw
At the end of the add command, disable and free the fscache
2019-12-27 09:26:20 +01:00
Johannes Schindelin
ce52d8d04e Merge pull request #1911 from benpeart/git_test_fscache-gfw
fscache: add GIT_TEST_FSCACHE support
2019-12-27 09:26:20 +01:00
Johannes Schindelin
7aa3a5338e Merge pull request #1909 from benpeart/free-fscache-after-status-gfw
status: disable and free fscache at the end of the status command
2019-12-27 09:26:19 +01:00
Johannes Schindelin
c8fa3c784d Merge pull request #1908 from benpeart/FindFirstFileEx-gfw
fscache: use FindFirstFileExW to avoid retrieving the short name
2019-12-27 09:26:19 +01:00
Johannes Schindelin
39f0ed019f Merge pull request #1827 from benpeart/fscache_refresh_index
Enable the filesystem cache (fscache) in refresh_index().
2019-12-27 09:26:19 +01:00
Johannes Schindelin
f89742986d Merge pull request #1468 from atetubou/fscache_checkout_flush
checkout.c: enable fscache for checkout again

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:18 +01:00
Johannes Schindelin
67e5f7bb5e Merge pull request #1426 from atetubou/fetch_pack
fetch-pack.c: enable fscache for stats under .git/objects
2019-12-27 09:26:18 +01:00
Johannes Schindelin
a0d9b4dba9 Merge pull request #1344 from jeffhostetler/perf_add_excludes_with_fscache
dir.c: make add_excludes aware of fscache during status
2019-12-27 09:26:17 +01:00
Johannes Schindelin
1625ac7200 Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2019-12-27 09:26:17 +01:00
Johannes Schindelin
1439cd1d58 Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd
fscache: add not-found directory cache to fscache
2019-12-27 09:26:16 +01:00
Johannes Schindelin
d21fe44415 Merge branch 'fscache' 2019-12-27 09:26:16 +01:00
Johannes Schindelin
60be411c6c Merge 'add-p-many-files'
This topic branch allows `add -p` and `add -i` with a large number of
files. It is kind of a hack that was never really meant to be
upstreamed. Let's see if we can do better in the built-in `add -p`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:15 +01:00
Johannes Schindelin
e940b61e51 Merge branch 'gitk-and-git-gui-patches'
These are Git for Windows' Git GUI and gitk patches. We will have to
decide at some point what to do about them, but that's a little lower
priority (as Git GUI seems to be unmaintained for the time being, and
the gitk maintainer keeps a very low profile on the Git mailing list,
too).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:14 +01:00
Johannes Schindelin
31bf0164d4 Merge branch 'ready-for-upstream'
This is the branch thicket of patches in Git for Windows that are
considered ready for upstream. To keep them in a ready-to-submit shape,
they are kept as close to the beginning of the branch thicket as
possible.
2019-12-27 09:26:14 +01:00
Johannes Schindelin
b292f98cf3 mingw: really handle SIGINT
Previously, we did not install any handler for Ctrl+C, but now we really
want to because the MSYS2 runtime learned the trick to call the
ConsoleCtrlHandler when Ctrl+C was pressed.

With this, hitting Ctrl+C while `git log` is running will only terminate
the Git process, but not the pager. This finally matches the behavior on
Linux and on macOS.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:11 +01:00
Johannes Schindelin
32af6041d9 mingw: add a Makefile target to copy test artifacts
The Makefile target `install-mingit-test-artifacts` simply copies stuff
and things directly into a MinGit directory, including an init.bat
script to set everything up so that the tests can be run in a cmd
window.

Sadly, Git's test suite still relies on a Perl interpreter even if
compiled with NO_PERL=YesPlease. We punt for now, installing a small
script into /usr/bin/perl that hands off to an existing Perl of a Git
for Windows SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:11 +01:00
Johannes Schindelin
d464ca69bb mingw: kill child processes in a gentler way
The TerminateProcess() function does not actually leave the child
processes any chance to perform any cleanup operations. This is bad
insofar as Git itself expects its signal handlers to run.

A symptom is e.g. a left-behind .lock file that would not be left behind
if the same operation was run, say, on Linux.

To remedy this situation, we use an obscure trick: we inject a thread
into the process that needs to be killed and to let that thread run the
ExitProcess() function with the desired exit status. Thanks J Wyman for
describing this trick.

The advantage is that the ExitProcess() function lets the atexit
handlers run. While this is still different from what Git expects (i.e.
running a signal handler), in practice Git sets up signal handlers and
atexit handlers that call the same code to clean up after itself.

In case that the gentle method to terminate the process failed, we still
fall back to calling TerminateProcess(), but in that case we now also
make sure that processes spawned by the spawned process are terminated;
TerminateProcess() does not give the spawned process a chance to do so
itself.

Please note that this change only affects how Git for Windows tries to
terminate processes spawned by Git's own executables. Third-party
software that *calls* Git and wants to terminate it *still* need to make
sure to imitate this gentle method, otherwise this patch will not have
any effect.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:11 +01:00
Johannes Schindelin
14ce6537e6 t9200: skip tests when $PWD contains a colon
On Windows, the current working directory is pretty much guaranteed to
contain a colon. If we feed that path to CVS, it mistakes it for a
separator between host and port, though.

This has not been a problem so far because Git for Windows uses MSYS2's
Bash using a POSIX emulation layer that also pretends that the current
directory is a Unix path (at least as long as we're in a shell script).

However, that is rather limiting, as Git for Windows also explores other
ports of other Unix shells. One of those is BusyBox-w32's ash, which is
a native port (i.e. *not* using any POSIX emulation layer, and certainly
not emulating Unix paths).

So let's just detect if there is a colon in $PWD and punt in that case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:11 +01:00
Johannes Schindelin
f6b00b9391 t7063: when running under BusyBox, avoid unsupported find option
BusyBox' find implementation does not understand the -ls option, so
let's not use it when we're running inside BusyBox.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:11 +01:00
Johannes Schindelin
c0ccd2e806 t5813: allow for $PWD to be a Windows path
Git for Windows uses MSYS2's Bash to run the test suite, which comes
with benefits but also at a heavy price: on the plus side, MSYS2's
POSIX emulation layer allows us to continue pretending that we are on a
Unix system, e.g. use Unix paths instead of Windows ones, yet this is
bought at a rather noticeable performance penalty.

There *are* some more native ports of Unix shells out there, though,
most notably BusyBox-w32's ash. These native ports do not use any POSIX
emulation layer (or at most a *very* thin one, choosing to avoid
features such as fork() that are expensive to emulate on Windows), and
they use native Windows paths (usually with forward slashes instead of
backslashes, which is perfectly legal in almost all use cases).

And here comes the problem: with a $PWD looking like, say,
C:/git-sdk-64/usr/src/git/t/trash directory.t5813-proto-disable-ssh
Git's test scripts get quite a bit confused, as their assumptions have
been shattered. Not only does this path contain a colon (oh no!), it
also does not start with a slash.

This is a problem e.g. when constructing a URL as t5813 does it:
ssh://remote$PWD. Not only is it impossible to separate the "host" from
the path with a $PWD as above, even prefixing $PWD by a slash won't
work, as /C:/git-sdk-64/... is not a valid path.

As a workaround, detect when $PWD does not start with a slash on
Windows, and simply strip the drive prefix, using an obscure feature of
Windows paths: if an absolute Windows path starts with a slash, it is
implicitly prefixed by the drive prefix of the current directory. As we
are talking about the current directory here, anyway, that strategy
works.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:10 +01:00
Johannes Schindelin
22c419c25d t5605: special-case hardlink test for BusyBox-w32
When t5605 tries to verify that files are hardlinked (or that they are
not), it uses the `-links` option of the `find` utility.

BusyBox' implementation does not support that option, and BusyBox-w32's
lstat() does not even report the number of hard links correctly (for
performance reasons).

So let's just switch to a different method that actually works on
Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:10 +01:00
Johannes Schindelin
7391df7f39 t5532: workaround for BusyBox on Windows
While it may seem super convenient to some old Unix hands to simpy
require Perl to be available when running the test suite, this is a
major hassle on Windows, where we want to verify that Perl is not,
actually, required in a NO_PERL build.

As a super ugly workaround, we "install" a script into /usr/bin/perl
reading like this:

	#!/bin/sh

	# We'd much rather avoid requiring Perl altogether when testing
	# an installed Git. Oh well, that's why we cannot have nice
	# things.
	exec c:/git-sdk-64/usr/bin/perl.exe "$@"

The problem with that is that BusyBox assumes that the #! line in a
script refers to an executable, not to a script. So when it encounters
the line #!/usr/bin/perl in t5532's proxy-get-cmd, it barfs.

Let's help this situation by simply executing the Perl script with the
"interpreter" specified explicitly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-27 09:26:10 +01:00