Commit Graph

121649 Commits

Author SHA1 Message Date
Johannes Schindelin
f1590a75e2 Merge pull request #3297 from dscho/docs-about-testing-git-in-place
Document how to build (and test) Git for Windows
2021-06-26 22:26:53 +02:00
Johannes Schindelin
2f88978401 fixup! README.md: Add a Windows-specific preamble
Add a section instructing developers how to build, and how to test the
just-built executables in-place.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-25 23:25:11 +02:00
Johannes Schindelin
c0919c9ed5 Merge pull request #3293 from pascalmuller/http-support-automatically-sending-client-certificate
http: Add support for enabling automatic sending of SSL client certificate
2021-06-24 20:32:51 +02:00
Pascal Muller
c1293427d0 http: optionally send SSL client certificate
This adds support for a new http.sslAutoClientCert config value.

In cURL 7.77 or later the schannel backend does not automatically send
client certificates from the Windows Certificate Store anymore.

This config value is only used if http.sslBackend is set to "schannel",
and can be used to opt in to the old behavior and force cURL to send
client certificates.

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

Signed-off-by: Pascal Muller <pascalmuller@gmail.com>
2021-06-24 14:27:01 +02:00
Johannes Schindelin
47d568403f Merge pull request #3287 from dscho/redo-fsmonitor-null-last-update
Redo fix for FSMonitor
2021-06-21 23:24:06 +02:00
Jeff Hostetler
65a2766b34 fixup! fsmonitor: introduce core.useBuiltinFSMonitor to call the daemon via IPC
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2021-06-21 21:29:39 +02:00
Johannes Schindelin
5b320b3764 Merge pull request #3275 from dscho/monitor-libgcrypt
Monitor libgpg-error and libgcrypt versions
2021-06-17 09:30:55 +02:00
Johannes Schindelin
75f0e21527 fixup! Add a GitHub workflow to monitor component updates
Since we're now watching out for new libgcrypt versions, let's also
watch out for its dependency libgpg-error.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-16 13:50:14 +02:00
Johannes Schindelin
99984b34fa fixup! Add a GitHub workflow to monitor component updates
Let's watch out for new libgcrypt versions, too (this component is a
pretty important dependency of gnupg).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-16 13:50:14 +02:00
Johannes Schindelin
b312fa405f Merge pull request #3263 from dscho/fix-built-in-fsmonitor
FSMonitor fixes
2021-06-09 18:05:27 +02:00
Johannes Schindelin
cfa0c45308 fixup! fsmonitor--daemon: use a cookie file to sync with file system
When the built-in FSMonitor receives an invalid v2 token, we do not
actually need to wait for a cookie file. There simply is no use for
waiting in this instance. It's not like the client will all of a sudden
realize that it sent an incorrect token and somehow make up a correct
token from thin air in a follow-up query.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-09 11:30:46 +02:00
Johannes Schindelin
bc40a560d3 fixup! fsmonitor: introduce core.useBuiltinFSMonitor to call the daemon via IPC
In FSMonitor v1, we made sure to only use a valid `since_token` when
querying the FSMonitor. This condition was accidentally lost in v2, and
caused segmentation faults uncovered by Scalar's Functional Tests.

I had tried to fix this in https://github.com/git-for-windows/pull/3241,
but the fix was incomplete, and I had to follow up with
https://github.com/git-for-windows/pull/3258. However, it turns out that
both of them were actually only work-arounds; I should have dug deeper
to figure out _why_ the `since_token` was no longer guaranteed not to be
`NULL`, and I finally did.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-09 11:30:45 +02:00
Johannes Schindelin
92392daccb fixup! fsmonitor--daemon: use a cookie file to sync with file system
When the built-in FSMonitor receives an unexpected token, we do not
actually need to wait for a cookie file. There simply is no use for
waiting in this instance. It's not like the client will all of a sudden
realize that it sent an incorrect token and somehow make up a correct
token from thin air in a follow-up query.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-09 11:30:45 +02:00
Johannes Schindelin
5ec07b8c4a fixup! fsmonitor--daemon: use a cookie file to sync with file system
When flushing the FSMonitor data, we do not actually need to wait for a
cookie file. In the worst case, we will over-report a bit.

If we _do_ wait for a cookie file, in the worst case we cause a hang
because the FSMonitor daemon will wait and wait even though the `.git/`
directory might be gone already.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-09 11:30:45 +02:00
Johannes Schindelin
7eb8372f9f fixup! fsmonitor-ipc: create client routines for git-fsmonitor--daemon
Now that we have a correct fix where we guarantee again (just like
v1 of the built-in FSMonitor) that `since_token` is not `NULL`, we can
revert the work-arounds introduced by these two PRs:

- https://github.com/git-for-windows/pull/3241

- https://github.com/git-for-windows/pull/3258

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-09 11:30:45 +02:00
Johannes Schindelin
4c204998d0 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
v2.32.0.windows.1
2021-06-07 13:17:37 +02:00
Johannes Schindelin
49ab356854 Merge pull request #2837 from dscho/monitor-component-updates
Start monitoring updates of Git for Windows' component in the open
2021-06-07 13:17:36 +02:00
Johannes Schindelin
05dcc28835 Merge branch 'phase-out-reset-stdin'
This topic branch re-adds the deprecated --stdin/-z options to `git
reset`. Those patches were overridden by a different set of options in
the upstream Git project before we could propose `--stdin`.

We offered this in MinGit to applications that wanted a safer way to
pass lots of pathspecs to Git, and these applications will need to be
adjusted.

Instead of `--stdin`, `--pathspec-from-file=-` should be used, and
instead of `-z`, `--pathspec-file-nul`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:35 +02:00
Johannes Schindelin
c62914926f Merge pull request #1354 from dscho/phase-out-show-ignored-directory-gracefully
Phase out `--show-ignored-directory` gracefully
2021-06-07 13:17:35 +02:00
Johannes Schindelin
9de0986555 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>
2021-06-07 13:17:34 +02:00
Johannes Schindelin
b77e8454e6 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>
2021-06-07 13:17:34 +02:00
Johannes Schindelin
d6abe2016f Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:33 +02:00
Johannes Schindelin
a01ee50dc5 Merge pull request #1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2021-06-07 13:17:33 +02:00
Johannes Schindelin
2d2c48a723 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>
2021-06-07 13:17:32 +02:00
Johannes Schindelin
23990c4c55 Merge branch 'kblees/kb/symlinks' 2021-06-07 13:17:32 +02:00
Johannes Schindelin
4cffb69020 Merge branch 'msys2' 2021-06-07 13:17:31 +02:00
Johannes Schindelin
4a5df48b7f Merge branch 'long-paths' 2021-06-07 13:17:30 +02:00
Johannes Schindelin
c435be679b 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>
2021-06-07 13:17:30 +02:00
Johannes Schindelin
e004dc207e 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>
2021-06-07 13:17:29 +02:00
Alejandro Barreto
9e90965ea7 Document how $HOME is set on Windows
Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does not specify how or where these values come from on Windows where neither is set by default. The new documentation reflects the behavior of setup_windows_environment() in compat/mingw.c.

Signed-off-by: Alejandro Barreto <alejandro.barreto@ni.com>
2021-06-07 13:17:29 +02:00
Johannes Schindelin
97eed41950 .github: Add configuration for the Sentiment Bot
The sentiment bot will help detect when things get too heated.
Hopefully.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:29 +02:00
Johannes Schindelin
441d61f24d Add a GitHub workflow to monitor component updates
Rather than using private IFTTT Applets that send mails to this
maintainer whenever a new version of a Git for Windows component was
released, let's use the power of GitHub workflows to make this process
publicly visible.

This workflow monitors the Atom/RSS feeds, and opens a ticket whenever a
new version was released.

Note: Bash sometimes releases multiple patched versions within a few
minutes of each other (i.e. 5.1p1 through 5.1p4, 5.0p15 and 5.0p16). The
MSYS2 runtime also has a similar system. We can address those patches as
a group, so we shouldn't get multiple issues about them.

Note further: We're not acting on newlib releases, OpenSSL alphas, Perl
release candidates or non-stable Perl releases. There's no need to open
issues about them.

Co-authored-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:28 +02:00
Johannes Schindelin
51ea1f0723 reset: reinstate support for the deprecated --stdin option
The `--stdin` option was a well-established paradigm in other commands,
therefore we implemented it in `git reset` for use by Visual Studio.

Unfortunately, upstream Git decided that it is time to introduce
`--pathspec-from-file` instead.

To keep backwards-compatibility for some grace period, we therefore
reinstate the `--stdin` option on top of the `--pathspec-from-file`
option, but mark it firmly as deprecated.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:28 +02:00
Philip Oakley
718a28ac63 Modify the GitHub Pull Request template (to reflect Git for Windows)
Git for Windows accepts pull requests; Core Git does not. Therefore we
need to adjust the template (because it only matches core Git's
project management style, not ours).

Also: direct Git for Windows enhancements to their contributions page,
space out the text for easy reading, and clarify that the mailing list
is plain text, not HTML.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:28 +02:00
Brendan Forster
75d80f37a0 Add an issue template
With improvements by Clive Chan, Adric Norris, Ben Bodenmiller and
Philip Oakley.

Helped-by: Clive Chan <cc@clive.io>
Helped-by: Adric Norris <landstander668@gmail.com>
Helped-by: Ben Bodenmiller <bbodenmiller@hotmail.com>
Helped-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Brendan Forster <brendan@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:28 +02:00
Johannes Schindelin
0978c1f57b README.md: Add a Windows-specific preamble
Includes touch-ups by Philip Oakley.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:28 +02:00
Derrick Stolee
a4231eab15 CONTRIBUTING.md: add guide for first-time contributors
Getting started contributing to Git can be difficult on a Windows
machine. CONTRIBUTING.md contains a guide to getting started, including
detailed steps for setting up build tools, running tests, and
submitting patches to upstream.

[includes an example by Pratik Karki how to submit v2, v3, v4, etc.]

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2021-06-07 13:17:28 +02:00
Johannes Schindelin
06ef6974ef Modify the Code of Conduct for Git for Windows
The Git project followed suite and added their Code of Conduct, based on
the Contributors' Covenant v1.4.

We edit it slightly to reflect Git for Windows' particulars.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:28 +02:00
Johannes Schindelin
35f7c6d557 status: reinstate --show-ignored-directory as a deprecated option
It was a bad idea to just remove that option from Git for Windows
v2.15.0, as early users of that (still experimental) option would have
been puzzled what they are supposed to do now.

So let's reintroduce the flag, but make sure to show the user good
advice how to fix this going forward.

We'll remove this option in a more orderly fashion when we're certain
that the option is no longer used (previous Visual Studio versions
relied on it).

The option is deprecated now, therefore we make sure that keeps saying
so until we finally remove it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:27 +02:00
Johannes Schindelin
7c6e866918 status: carry the --no-lock-index option for backwards-compatibility
When a third-party tool periodically runs `git status` in order to keep
track of the state of the working tree, it is a bad idea to lock the
index: it might interfere with interactive commands executed by the
user, e.g. when the user wants to commit files.

Git for Windows introduced the `--no-lock-index` option a long time ago
to fix that (it made it into Git for Windows v2.9.2(3)) by simply
avoiding to write that file.

The downside is that the periodic `git status` calls will be a little
bit more wasteful because they may have to refresh the index repeatedly,
only to throw away the updates when it exits. This cannot really be
helped, though, as tools wanting to get a periodic update of the status
have no way to predict when the user may want to lock the index herself.

Sadly, a competing approach was submitted (by somebody who apparently
has less work on their plate than this maintainer) that made it into
v2.15.0 but is *different*: instead of a `git status`-only option, it is
an option that comes *before* the Git command and is called differently,
too.

Let's give previous users a chance to upgrade to newer Git for Windows
versions by handling the `--no-lock-index` option, still, though with a
big fat warning.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:27 +02:00
Johannes Schindelin
90c58287b2 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
50d0231229 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
ca92983b03 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
ed62b10112 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
6ac57804e4 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
8160b0d2f1 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
e297422646 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>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
986404659a t5003: use binary file from t/lib-diff/
At some stage, t5003-archive-zip wants to add a file that is not ASCII.
To that end, it uses /bin/sh. But that file may actually not exist (it
is too easy to forget that not all the world is Unix/Linux...)! Besides,
we already have perfectly fine binary files intended for use solely by
the tests. So let's use one of them instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
e462a8e838 t0021: use Windows path when appropriate
Since c6b0831c9c (docs: warn about possible '=' in clean/smudge filter
process values, 2016-12-03), t0021 writes out a file with quotes in its
name, and MSYS2's path conversion heuristics mistakes that to mean that
we are not talking about a path here.

Therefore, we need to use Windows paths, as the test-helper is a Win32
program that would otherwise have no idea where to look for the file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:26 +02:00
Johannes Schindelin
13fc864957 test-lib: add BUSYBOX prerequisite
When running with BusyBox, we will want to avoid calling executables on
the PATH that are implemented in BusyBox itself.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-06-07 13:17:26 +02:00