Commit Graph

83414 Commits

Author SHA1 Message Date
Thomas Braun
afed05ab8f Config option to disable side-band-64k for transport
Since commit 0c499ea60f the send-pack builtin uses the side-band-64k
capability if advertised by the server.

Unfortunately this breaks pushing over the dump git protocol if used
over a network connection.

The detailed reasons for this breakage are (by courtesy of Jeff Preshing,
quoted from ttps://groups.google.com/d/msg/msysgit/at8D7J-h7mw/eaLujILGUWoJ):
----------------------------------------------------------------------------
MinGW wraps Windows sockets in CRT file descriptors in order to mimic the
functionality of POSIX sockets. This causes msvcrt.dll to treat sockets as
Installable File System (IFS) handles, calling ReadFile, WriteFile,
DuplicateHandle and CloseHandle on them. This approach works well in simple
cases on recent versions of Windows, but does not support all usage patterns.
In particular, using this approach, any attempt to read & write concurrently
on the same socket (from one or more processes) will deadlock in a scenario
where the read waits for a response from the server which is only invoked after
the write. This is what send_pack currently attempts to do in the use_sideband
codepath.
----------------------------------------------------------------------------

The new config option "sendpack.sideband" allows to override the side-band-64k
capability of the server, and thus makes the dump git protocol work.

Other transportation methods like ssh and http/https still benefit from
the sideband channel, therefore the default value of "sendpack.sideband"
is still true.

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2018-05-29 19:25:42 +02:00
Johannes Schindelin
719b3aba4b Start the merging-rebase to v2.17.1
This is the rebase to the *real* v2.17.1. Due to details of the process
that are probably pretty boring to anybody but Git for Windows'
maintainer (read: me myself), Git for Windows v2.17.1 is based on an
older revision of Git v2.17.1 that was pulled due to an influential
person who thought that .gitignore and .gitattributes should not enjoy
the same protection as .gitmodules (an assessment with which I
wholeheartedly disagree, but there's nothing I could do, my voice did
not weigh enough, I guess).

This commit starts the rebase of 8a8c9484c3 to 5b62a68cad

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-29 19:22:47 +02:00
Johannes Schindelin
e48ea7ff1d Merge branch 'colorize-push-errors'
To help users discern large chunks of white text (when the push
succeeds) from large chunks of white text (when the push fails), let's
add some color to the latter.

This closes https://github.com/git-for-windows/git/pull/1429 and fixes
https://github.com/git-for-windows/git/issues/1422

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:27:56 +02:00
Johannes Schindelin
0dba629418 Merge branch 'dj/runtime-prefix'
Two more commits made it into the dj/runtime-prefix branch before being
merged into core Git's `master`. Let's take those two, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:27:52 +02:00
Johannes Schindelin
f078ce798b Merge pull request #1679 from telezhnaya/win
vcxproj: change build logic
2018-05-24 15:27:48 +02:00
Jonathan Nieder
0bccef054d Makefile: quote $INSTLIBDIR when passing it to sed
f6a0ad4b (Makefile: generate Perl header from template file,
2018-04-10) moved code for generating the 'use lib' lines at the top
of perl scripts from the $(SCRIPT_PERL_GEN) rule to a separate
GIT-PERL-HEADER rule.

This rule first populates INSTLIBDIR and then substitutes it into the
GIT-PERL-HEADER using sed:

	INSTLIBDIR=... something ...
	sed -e 's=@@INSTLIBDIR@@='$$INSTLIBDIR'=g' $< > $@

Because $INSTLIBDIR is not surrounded by double quotes, the shell
splits it at each space, causing errors if INSTLIBDIR contains an $IFS
character:

 sed: 1: "s=@@INSTLIBDIR@@=/usr/l ...": unescaped newline inside substitute pattern

Add back the missing double-quotes to make it work again.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-24 15:27:28 +02:00
Olga Telezhnaia
911491fe76 vcxproj: change build logic
Add new condition to invoke vcpkg_install.bat: it's not enough to check
the presence of folder vcpkg. We need to check the presence of some
header files because this is one of the main goals of this script.
Previous build attempt could be aborted, so the folder will exist but
the project will not be built properly.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
2018-05-24 15:27:28 +02:00
Jonathan Nieder
8d2c7386e7 Makefile: remove unused @@PERLLIBDIR@@ substitution variable
Junio noticed that this variable is not quoted correctly when it is
passed to sed.  As a shell-quoted string, it should be inside
single-quotes like $(perllibdir_relative_SQ), not outside them like
$INSTLIBDIR.

In fact, this substitution variable is not used.  Simplify by removing
it.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-24 15:27:28 +02:00
Johannes Schindelin
06674eb1b0 Merge branch 'cb/bash-completion-ls-files-processing' into next
Shell completion (in contrib) that gives list of paths have been
optimized somewhat.

* cb/bash-completion-ls-files-processing:
  completion: improve ls-files filter performance

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:27:25 +02:00
Johannes Schindelin
28fdf63729 Merge pull request #1645 from ZCube/master
Support windows container.
2018-05-24 15:27:21 +02:00
Johannes Schindelin
7114c1f5b1 Merge branch 'ab/install-symlinks'
The build procedure learned to optionally use symbolic links
(instead of hardlinks and copies) to install "git-foo" for built-in
commands, whose binaries are all identical.

* ab/install-symlinks:
  Makefile: optionally symlink libexec/git-core binaries to bin/git
  Makefile: add a gitexecdir_relative variable
  Makefile: fix broken bindir_relative variable

[jes: merged into Git for Windows early, to facilitate work on skipping
the builtins entirely if desired, if I ever find the time to work on
this...]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:27:12 +02:00
Johannes Schindelin
2df74d673f Merge branch 'ctrl-c'
This is part two of the Ctrl+C story, where part one is
https://github.com/git-for-windows/MSYS2-packages/commit/f4fda0f30aa.

Part one took care of extending the signal handling in the MSYS2 runtime
such that non-MSYS2 processes "receive" a SIGINT by injecting a remote
thread that runs kernel32!CtrlRoutine as if GenerateConsoleCtrlHandler()
had been called (but in contrast to the latter, only one process is
targeted at a time, not every process attached to the same Console) into
the process that needs to be interrupted as well as into all of the
spawned child processes.

Part two now takes care of removing the misguided "kill all spawned
children" atexit() handler, and it also installs a ConsoleCtrl handler
to run Git's SIGINT handlers, such as the one waiting for the pager to
exit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:20:58 +02:00
Johannes Schindelin
242e248005 Merge branch 'quote-braces'
This merges https://github.com/git-for-windows/git/pull/1637 with an
added regression test and a new commit message ready for the next
merging rebase (where the faulty commit will be amended).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:20:54 +02:00
Johannes Schindelin
7be21394f8 Merge branch 'dj/runtime-prefix'
This topic branch first reverts a couple of conflicting patches and then
cherry-picks Dan Jacques' patches to support RUNTIME_PREFIX also on
other platforms than Windows. The original patches are already well
under way into the next Git version, and we just take them early to give
it a bit more testing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:20:35 +02:00
Johannes Schindelin
297141dd26 Merge pull request #1567 from derrickstolee/whitespace
CONTRIBUTING.md: check for whitespace before submitting
2018-05-24 15:20:14 +02:00
Johannes Schindelin
346c957665 Merge pull request #1567 from derrickstolee/whitespace
CONTRIBUTING.md: check for whitespace before submitting
2018-05-24 15:20:02 +02:00
Johannes Schindelin
83c2212da0 Merge pull request #1564 from git-for-windows/larsxschneider-patch-1
CONTRIBUTING.md: Fix typo
2018-05-24 15:19:51 +02:00
Johannes Schindelin
0d412164ab Merge pull request #1548 from alejandro5042/master
Document how $HOME is set on Windows
2018-05-24 15:19:41 +02:00
Johannes Schindelin
ac61bd3e77 Merge branch 'fix-unc-buffer-overflow'
This fixes `git status` in a Git worktree at the top of a file share.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:19:30 +02:00
Johannes Schindelin
b3c14b87a7 Merge pull request #1529 from derrickstolee/contributing
Rewrite CONTRIBUTING.md to be a guide for new developers on Windows
2018-05-24 15:19:27 +02:00
Johannes Schindelin
734eee230c Merge pull request #1468 from atetubou/fscache_checkout_flush
checkout.c: enable fscache for checkout again
2018-05-24 15:19:11 +02:00
Johannes Schindelin
a6c84ee94d Merge branch 'fix-terminal-prompt'
This fixes the issue identified in

	https://github.com/git-for-windows/git/issues/1498

where Git would not fall back to reading credentials from a Win32
Console when the credentials could not be read from the terminal via the
Bash hack (that is necessary to support running in a MinTTY).

Tested in a Powershell window.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:19:07 +02:00
Johannes Schindelin
4eb979ca3e Merge branch 'fix-vcxproj-generation'
We ran out of GUIDs in the script generating Visual Studio project
files. This topic branch fixes that issue once and for all, by
generating the GUIDs.

For extra goodness, we now generate GUIDs that are not random, but are
generated from the SHA-256 checksums of the target file of the project.
That way, the project<->GUID mapping is stable.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:19:04 +02:00
Johannes Schindelin
7ebc516e46 git_setup_gettext: plug memory leak
The system_path() function returns a freshly-allocated string. We need
to release it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
70ae0f4da3 mingw: Windows Docker volumes are *not* symbolic links
... even if they may look like them.

As looking up the target of the "symbolic link" (just to see whether it
starts with `/ContainerMappedDirectories/`) is pretty expensive, we
do it when we can be *really* sure that there is a possibility that this
might be the case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: JiSeop Moon <zcube@zcube.kr>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
b422d1123a 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>
2018-05-24 15:18:14 +02:00
Derrick Stolee
c904681acd CONTRIBUTING.md: check for whitespace before submitting
Whitespace errors are easy to create but hard to check manually. Add
two git commands that detect these whitespace errors to the commit
cleanup section of CONTRIBUTING.md.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2018-05-24 15:18:14 +02:00
Lars Schneider
7f7049d2c6 CONTRIBUTING.md: Fix typo
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
2018-05-24 15:18:14 +02:00
Alejandro Barreto
f7299ea2e2 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>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
83e764a740 setup_git_directory(): handle UNC root paths correctly
When working in the root directory of a file share (this is only
possible in Git Bash and Powershell, but not in CMD), the current
directory is reported without a trailing slash.

This is different from Unix and standard Windows directories: both / and
C:\ are reported with a trailing slash as current directories.

If a Git worktree is located there, Git is not quite prepared for that:
while it does manage to find the .git directory/file, it returns as
length of the top-level directory's path *one more* than the length of
the current directory, and setup_git_directory_gently() would then
return an undefined string as prefix.

In practice, this undefined string usually points to NUL bytes, and does
not cause much harm. Under rare circumstances that are really involved
to reproduce (and not reliably so), the reported prefix could be a
suffix string of Git's exec path, though.

A careful analysis determined that this bug is unlikely to be
exploitable, therefore we mark this as a regular bug fix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Derrick Stolee
4e12924339 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.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2018-05-24 15:18:14 +02:00
Takuto Ikuta
c8acda80a8 checkout.c: enable fscache for checkout again
This is retry of #1419.

I added flush_fscache macro to flush cached stats after disk writing
with tests for regression reported in #1438 and #1442.

git checkout checks each file path in sorted order, so cache flushing does not
make performance worse unless we have large number of modified files in
a directory containing many files.

Using chromium repository, I tested `git checkout .` performance when I
delete 10 files in different directories.
With this patch:
TotalSeconds: 4.307272
TotalSeconds: 4.4863595
TotalSeconds: 4.2975562
Avg: 4.36372923333333

Without this patch:
TotalSeconds: 20.9705431
TotalSeconds: 22.4867685
TotalSeconds: 18.8968292
Avg: 20.7847136

I confirmed this patch passed all tests in t/ with core_fscache=1.

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
325fc0ad3f mingw (git_terminal_prompt): turn on echo explictly
It turns out that when running in a Powershell window, we need to turn
on ENABLE_ECHO_INPUT because the default would be *not* to echo
anything.

This also ensures that we use the input mode where all input is read
until the user hits the Return key.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
cf1075f5a2 .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>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
ff3802182f buildsystems(Vcproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Note: the Vcproj generator is probably only interesting for historical
reasons; nevertheless, the Vcxproj generator in the Git for Windows
project is based on the Vcproj generator and it is better to backport
the fix than to let Vcproj have the hard-coded list of GUIDs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
3555005e96 gettext: avoid initialization if the locale dir is not present
The runtime of a simple `git.exe version` call on Windows is currently
dominated by the gettext setup, adding a whopping ~150ms to the ~210ms
total.

Given that this cost is added to each and every git.exe invocation goes
through common-main's invocation of git_setup_gettext(), and given that
scripts have to call git.exe dozens, if not hundreds, of times, this is
a substantial performance penalty.

This is particularly pointless when considering that Git for Windows
ships without localization (to keep the installer's size to a bearable
~34MB): all that time setting up gettext is for naught.

So let's be smart about it and skip setting up gettext if the locale
directory is not even present.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
JiSeop Moon
6f02a2e584 mingw: move the file_attr_to_st_mode() function definition
In preparation for making this function a bit more complicated (to allow
for special-casing the `ContainerMappedDirectories` in Windows
containers, which look like a symbolic link, but are not), let's move it
out of the header.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Derrick Stolee
5d44b2c702 CODE_OF_CONDUCT: Rename CONTRIBUTING.md to CODE_OF_CONDUCT.md
The current CONTRIBUTING.md file is actually a code of conduct. This is
a valuable document, but is misnamed. A following patch will replace
CONTRIBUTING.md with a guide to contributing to Git using a Windows machine.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2018-05-24 15:18:14 +02:00
Takuto Ikuta
0cbb44afb0 fetch-pack.c: enable fscache for stats under .git/objects
When I do git fetch, git call file stats under .git/objects for each
refs. This takes time when there are many refs.

By enabling fscache, git takes file stats by directory traversing and that
improved the speed of fetch-pack for repository having large number of
refs.

In my windows workstation, this improves the time of `git fetch` for
chromium repository like below. I took stats 3 times.

* With this patch
TotalSeconds: 9.9825165
TotalSeconds: 9.1862075
TotalSeconds: 10.1956256
Avg: 9.78811653333333

* Without this patch
TotalSeconds: 15.8406702
TotalSeconds: 15.6248053
TotalSeconds: 15.2085938
Avg: 15.5580231

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
f2c5c574a8 mingw (git_terminal_prompt): do fall back to CONIN$/CONOUT$ method
To support Git Bash running in a MinTTY, we use a dirty trick to access
the MSYS2 pseudo terminal: we execute a Bash snippet that accesses
/dev/tty.

The idea was to fall back to writing to/reading from CONOUT$/CONIN$ if
that Bash call failed because Bash was not found.

However, we should fall back even in other error conditions, because we
have not successfully read the user input. Let's make it so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
13c6916f2c add --edit: truncate the patch file
If there is already a .git/ADD_EDIT.patch file, we fail to truncate it
properly, which could result in very funny errors.

Let's just truncate it and not worry about it too much.

Reported by J Wyman.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
10066e76b8 Merge pull request #1450 from shiftkey/schannel-norevoke-support
adding http.schannel.checkRevoke support
2018-05-24 15:18:41 +02:00
Johannes Schindelin
af2e534b1c 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>
2018-05-24 15:18:37 +02:00
Johannes Schindelin
1b4ff214dc Merge pull request #1426 from atetubou/fetch_pack
fetch-pack.c: enable fscache for stats under .git/objects
2018-05-24 15:18:21 +02:00
Johannes Schindelin
c76f88abab buildsystems(vcxproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
0c5001d637 mingw/msvc: use the new-style RUNTIME_PREFIX helper
This change also allows us to stop overriding argv[0] with the absolute
path of the executable, allowing us to preserve e.g. the case of the
executable's file name.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
JiSeop Moon
ce80b752b6 mingw: when running in a Windows container, try to rename() harder
It is a known issue that a rename() can fail with an "Access denied"
error at times, when copying followed by deleting the original file
works. Let's just fall back to that behavior.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
85e7f46d23 mingw (git_terminal_prompt): work around BusyBox & WSL issues
When trying to query the user directly via /dev/tty, both WSL's bash and
BusyBox' bash emulation seem to have problems printing the value that
they just read. The bash just stops in those instances, does not even
execute any commands after the echo command.

Let's just work around this by running the Bash snippet only in MSYS2's
Bash: its `SHELL` variable has the `.exe` suffix, and neither WSL's nor
BusyBox' bash set the `SHELL` variable to a path with that suffix. In
the latter case, we simply exit with code 127 (indicating that the
command was not found) and fall back to the CONIN$/CONOUT$ method
quietly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00
Brendan Forster
a91aa9195e add support for disabling SSL revocation checks in cURL
This adds support for a new http.schannel.checkRevoke config value.

This config value is only used if http.sslBackend is set to "schannel",
which forces cURL to use the Windows Certificate Store when validating
server certificates associated with a remote server.

This config value should only be set to "false" if you are in an
environment where revocation checks are blocked by the network, with
no alternative options.

This is only supported in cURL 7.44 or later.

Signed-off-by: Brendan Forster <github@brendanforster.com>
2018-05-24 15:18:14 +02:00
Johannes Schindelin
f9298c1a60 mingw: spawned processes need to inherit only standard handles
By default, CreateProcess() does not inherit any open file handles,
unless the bInheritHandles parameter is set to TRUE. Which we do need to
set because we need to pass in stdin/stdout/stderr to talk to the child
processes. Sadly, this means that all file handles (unless marked via
O_NOINHERIT) are inherited.

This lead to problems in GVFS Git, where a long-running read-object hook
is used to hydrate missing objects, and depending on the circumstances,
might only be called *after* Git opened a file handle.

Ideally, we would not open files without O_NOINHERIT unless *really*
necessary (i.e. when we want to pass the opened file handle as standard
handle into a child process), but apparently it is all-too-easy to
introduce incorrect open() calls: this happened, and prevented updating
a file after the read-object hook was started because the hook still
held a handle on said file.

Happily, there is a solution: as described in the "Old New Thing"
https://blogs.msdn.microsoft.com/oldnewthing/20111216-00/?p=8873 there
is a way, starting with Windows Vista, that lets us define precisely
which handles should be inherited by the child process.

And since we bumped the minimum Windows version for use with Git for
Windows to Vista with v2.10.1 (i.e. a *long* time ago), we can use this
method. So let's do exactly that.

We need to make sure that the list of handles to inherit does not
contain duplicates; Otherwise CreateProcessW() would fail with
ERROR_INVALID_ARGUMENT.

While at it, stop setting errno to ENOENT unless it really is the
correct value.

Also, fall back to not limiting handle inheritance under certain error
conditions (e.g. on Windows 7, which is a lot stricter in what handles
you can specify to limit to).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-05-24 15:18:14 +02:00