summaryrefslogtreecommitdiff
path: root/t/t6500-gc.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-05-07 21:51:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-08 06:04:25 (GMT)
commitc871fbee2b7aaa3458f422a6d69a321cbfd9808a (patch)
tree1e2969fb35638886c6ceb8e105ef2afb527fb31d /t/t6500-gc.sh
parent8104ec994ea3849a968b4667d072fedd1e688642 (diff)
downloadgit-c871fbee2b7aaa3458f422a6d69a321cbfd9808a.zip
git-c871fbee2b7aaa3458f422a6d69a321cbfd9808a.tar.gz
git-c871fbee2b7aaa3458f422a6d69a321cbfd9808a.tar.bz2
t6500(mingw): use the Windows PID of the shell
In Git for Windows, we use the MSYS2 Bash which inherits a non-standard PID model from Cygwin's POSIX emulation layer: every MSYS2 process has a regular Windows PID, and in addition it has an MSYS2 PID (which corresponds to a shadow process that emulates Unix-style signal handling). With the upgrade to the MSYS2 runtime v3.x, this shadow process cannot be accessed via `OpenProcess()` any longer, and therefore t6500 thought incorrectly that the process referenced in `gc.pid` (which is not actually a real `gc` process in this context, but the current shell) no longer exists. Let's fix this by making sure that the Windows PID is written into `gc.pid` in this test script so that `git.exe` is able to understand that that process does indeed still exist. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6500-gc.sh')
-rwxr-xr-xt/t6500-gc.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 4684d06..53258d4 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -162,7 +162,15 @@ test_expect_success 'background auto gc respects lock for all operations' '
# now fake a concurrent gc that holds the lock; we can use our
# shell pid so that it looks valid.
hostname=$(hostname || echo unknown) &&
- printf "$$ %s" "$hostname" >.git/gc.pid &&
+ shell_pid=$$ &&
+ if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid
+ then
+ # In Git for Windows, Bash (actually, the MSYS2 runtime) has a
+ # different idea of PIDs than git.exe (actually Windows). Use
+ # the Windows PID in this case.
+ shell_pid=$(cat /proc/$shell_pid/winpid)
+ fi &&
+ printf "%d %s" "$shell_pid" "$hostname" >.git/gc.pid &&
# our gc should exit zero without doing anything
run_and_wait_for_auto_gc &&