Commit Graph

102437 Commits

Author SHA1 Message Date
Johannes Schindelin
d01cfebc01 Merge pull request #2336 from dscho/program-data-config-owned-by-specific-administrator
Do not complain if `C:\ProgramData\Git\config` is owned by a specific administrator
2019-10-02 14:38:02 +02:00
Johannes Schindelin
8c5225c259 Merge pull request #2311 from PhilipOakley/versionnumbers
Security.md: include release candidate and snapshot information
2019-09-30 20:21:44 +02:00
Johannes Schindelin
b7585cc1c8 fixup! SECURITY.md: document Git for Windows' policies
Fix a few more unclear/incorrect phrasings (while the perfect is the
enemy of the good, the vague and the not-quite-right are the enemy of
the good-enough).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-09-30 20:18:56 +02:00
Philip Oakley
cf62fff637 fixup! SECURITY.md: document Git for Windows' policies
As suggested in
https://github.com/git-for-windows/git/pull/2303#issuecomment-524351036:

Also mention the release candidate and snapshot version numberings, e.g.
that the final release's installer will claim that the release candidates
are newer than the proper release.

And also note the existence of the snapshots; This may encourage others
to participate in the 'development'.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-09-30 20:05:43 +02:00
Johannes Schindelin
89eadabf80 Merge pull request #2297 from gix/fix/gitk-escape-paths
gitk: Escape file paths before piping to git log
2019-09-24 17:33:59 +02:00
Johannes Schindelin
8f8ffd9a00 config: treat any member of BUILTIN\Administrators as trusted
We recently hardened Git for Windows by ignoring
`C:\ProgramData\Git\config` files unless they are owned by the system
account, by the administrators group, or by the account under which Git
is running.

Turns out that there are situations when that config file is owned by
_an_ administrator, not by the entire administrators group, and that
still is okay. This can happen very easily e.g. in Docker Containers.

Let's add a fall back when the owner is none of the three currently
expected ones, enumerating the members of the administrators group and
comparing them to the file's owner. If a match is found, the owner is
not dubious.

Enumerating groups' members on Windows is not exactly a cheap operation,
and it requires linking to the `netapi32.dll`. Since this is rarely
needed, and since this is done at most a handful of times during any Git
process' life cycle, it is okay that it is a bit expensive. To avoid the
startup cost of linking to yet another DLL, we do this lazily instead:
that way, the vast majority of Git for Windows' users will not feel any
impact by this patch.

This fixes https://github.com/git-for-windows/git/issues/2304.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-09-18 11:32:34 +02:00
Johannes Schindelin
2608f2eaa7 fixup! Windows: add support for a Windows-wide configuration
Let's refactor the `validate_system_file_ownership()` a bit, not only to
clarify what is done, but also to prepare for maybe adding a slighty
more expensive check: it is possible that the file
`C:\ProgramData\Git\config` is owned by the local administrator (who has
a different SID than the `Administrators` group).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-09-17 23:48:39 +02:00
Johannes Schindelin
de7827bd27 Merge pull request #2315 from ROGERSM94/fix-rebase
rebase-merges: improve --rebase-merges label generation
2019-09-02 15:08:50 +02:00
Matt R
d3d6c4e420 rebase -r: let label generate safer labels
The `label` todo command in interactive rebases creates temporary refs
in the `refs/rewritten/` namespace. These refs are stored as loose refs,
i.e. as files in `.git/refs/rewritten/`, therefore they have to conform
with file name limitations on the current filesystem.

This poses a problem in particular on NTFS/FAT, where e.g. the colon
character is not a valid part of a file name.

Let's safeguard against this by replacing not only white-space
characters by dashes, but all non-alpha-numeric ones.

However, we exempt non-ASCII UTF-8 characters from that, as it should be
quite possible to reflect branch names such as `↯↯↯` in refs/file names.

Signed-off-by: Matthew Rogers <mattr94@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-09-02 14:11:11 +02:00
Johannes Schindelin
94ef49fdd4 Merge pull request #2316 from carenas/win-pcre1-cleanup
config.mak.uname: PCRE1 cleanup
2019-09-02 13:53:04 +02:00
Carlo Marcelo Arenas Belón
c3b0af9a65 config.mak.uname: PCRE1 cleanup
no longer relevant after moving to PCRE2

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
2019-08-31 06:30:18 -07:00
Johannes Schindelin
d7ae4d7b27 Merge pull request #2303 from git-for-windows/security.md
SECURITY.md: document Git for Windows' policies
2019-08-23 16:42:07 +02:00
Johannes Schindelin
41f46243bd SECURITY.md: document Git for Windows' policies
This is the recommended way on GitHub to describe policies revolving around
security issues and about supported versions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-08-23 14:14:42 +02:00
Nico Rieck
f0fe5288db gitk: Escape file paths before piping to git log
Fixes https://github.com/git-for-windows/git/issues/2293

Signed-off-by: Nico Rieck <nico.rieck@gmail.com>
2019-08-22 20:55:51 +02:00
Johannes Schindelin
4db2e5cc9e Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
v2.23.0.windows.1
2019-08-17 00:15:16 +02:00
Johannes Schindelin
a7b10db011 Merge pull request #1354 from dscho/phase-out-show-ignored-directory-gracefully
Phase out `--show-ignored-directory` gracefully
2019-08-17 00:15:15 +02:00
Johannes Schindelin
945c2b1f25 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-08-17 00:15:15 +02:00
Johannes Schindelin
ccd67ba563 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-08-17 00:15:14 +02:00
Johannes Schindelin
590e23eed6 Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-08-17 00:15:14 +02:00
Johannes Schindelin
7199b0195c Merge pull request #1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2019-08-17 00:15:14 +02:00
Johannes Schindelin
15775025a7 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-08-17 00:15:13 +02:00
Johannes Schindelin
2128137be9 Merge branch 'kblees/kb/symlinks' 2019-08-17 00:15:13 +02:00
Johannes Schindelin
9d62a57344 Merge branch 'msys2' 2019-08-17 00:15:12 +02:00
Johannes Schindelin
7111da72e9 Merge branch 'long-paths' 2019-08-17 00:15:12 +02:00
Johannes Schindelin
07a1b862af 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-08-17 00:15:12 +02:00
Derrick Stolee
86310c6739 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-08-17 00:15:11 +02:00
Johannes Schindelin
7693dacc8e Merge pull request #1937 from benpeart/fscache-NtQueryDirectoryFile-gfw
fscache: teach fscache to use NtQueryDirectoryFile
2019-08-17 00:15:11 +02:00
Johannes Schindelin
6901e28feb Merge pull request #1934 from benpeart/fscache-thread-safe-enable-gfw
fscache: make fscache_enable() thread safe
2019-08-17 00:15:11 +02:00
Johannes Schindelin
8180055540 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-08-17 00:15:10 +02:00
Johannes Schindelin
76270bd250 Merge pull request #1910 from benpeart/fscache_statistics-gfw
fscache: add fscache hit statistics
2019-08-17 00:15:10 +02:00
Johannes Schindelin
12717465f0 Merge pull request #1914 from benpeart/free-fscache-after-add-gfw
At the end of the add command, disable and free the fscache
2019-08-17 00:15:10 +02:00
Johannes Schindelin
25277f41f6 Merge pull request #1911 from benpeart/git_test_fscache-gfw
fscache: add GIT_TEST_FSCACHE support
2019-08-17 00:15:09 +02:00
Johannes Schindelin
63be74dc24 Merge pull request #1909 from benpeart/free-fscache-after-status-gfw
status: disable and free fscache at the end of the status command
2019-08-17 00:15:09 +02:00
Johannes Schindelin
598fc3f7dd Merge pull request #1908 from benpeart/FindFirstFileEx-gfw
fscache: use FindFirstFileExW to avoid retrieving the short name
2019-08-17 00:15:09 +02:00
Johannes Schindelin
a8bac60d65 Merge pull request #1827 from benpeart/fscache_refresh_index
Enable the filesystem cache (fscache) in refresh_index().
2019-08-17 00:15:08 +02:00
Johannes Schindelin
69ef7ebd44 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-08-17 00:15:08 +02:00
Johannes Schindelin
dd8ced59ad Merge pull request #1426 from atetubou/fetch_pack
fetch-pack.c: enable fscache for stats under .git/objects
2019-08-17 00:15:08 +02:00
Johannes Schindelin
0d9eb776d7 Merge pull request #1344 from jeffhostetler/perf_add_excludes_with_fscache
dir.c: make add_excludes aware of fscache during status
2019-08-17 00:15:07 +02:00
Johannes Schindelin
7d3ecab8aa Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2019-08-17 00:15:07 +02:00
Johannes Schindelin
c8f769b9ff Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd
fscache: add not-found directory cache to fscache
2019-08-17 00:15:07 +02:00
Johannes Schindelin
22452e5816 Merge branch 'fscache' 2019-08-17 00:15:07 +02:00
Johannes Schindelin
4c178b2141 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-08-17 00:15:06 +02:00
Johannes Schindelin
866ced2012 Merge branch 'inherit-only-stdhandles'
When spawning child processes, we do want them to inherit the standard
handles so that we can talk to them. We do *not* want them to inherit
any other handle, as that would hold a lock to the respective files
(preventing them from being renamed, modified or deleted), and the child
process would not know how to access that handle anyway.

Happily, there is an API to make that happen. It is supported in Windows
Vista and later, which is exactly what we promise to support in Git for
Windows for the time being.

This also means that we lift, at long last, the target Windows version
from Windows XP to Windows Vista.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-08-17 00:15:06 +02:00
Johannes Schindelin
0e69916845 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-08-17 00:15:06 +02:00
Johannes Schindelin
9aad62b7a3 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-08-17 00:15:05 +02:00
Johannes Schindelin
cfd1e4051e 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-08-17 00:15:03 +02:00
Johannes Schindelin
05bd9af2cc 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-08-17 00:15:03 +02:00
Johannes Schindelin
47242f66fc 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-08-17 00:15:03 +02:00
Johannes Schindelin
2397eb5655 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-08-17 00:15:03 +02:00
Johannes Schindelin
bba9f8041a 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-08-17 00:15:03 +02:00