From: Junio C Hamano Date: Sun, 19 May 2019 07:45:29 +0000 (+0900) Subject: Merge branch 'js/t6500-use-windows-pid-on-mingw' X-Git-Tag: v2.22.0-rc1~23 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b20b8fecfb3bc3fc27bc3709aba4e57f5388a62b?ds=inline;hp=-c Merge branch 'js/t6500-use-windows-pid-on-mingw' Future-proof a test against an update to MSYS2 runtime v3.x series. * js/t6500-use-windows-pid-on-mingw: t6500(mingw): use the Windows PID of the shell --- b20b8fecfb3bc3fc27bc3709aba4e57f5388a62b diff --combined t/t6500-gc.sh index 7411bf7fec,53258d45a1..515c6735e9 --- a/t/t6500-gc.sh +++ b/t/t6500-gc.sh @@@ -120,25 -120,6 +120,25 @@@ test_expect_success 'gc --quiet' test_must_be_empty stderr ' +test_expect_success 'gc.reflogExpire{Unreachable,}=never skips "expire" via "gc"' ' + test_config gc.reflogExpire never && + test_config gc.reflogExpireUnreachable never && + + GIT_TRACE=$(pwd)/trace.out git gc && + + # Check that git-pack-refs is run as a sanity check (done via + # gc_before_repack()) but that git-expire is not. + grep -E "^trace: (built-in|exec|run_command): git pack-refs --" trace.out && + ! grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out +' + +test_expect_success 'one of gc.reflogExpire{Unreachable,}=never does not skip "expire" via "gc"' ' + >trace.out && + test_config gc.reflogExpire never && + GIT_TRACE=$(pwd)/trace.out git gc && + grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out +' + run_and_wait_for_auto_gc () { # We read stdout from gc for the side effect of waiting until the # background gc process exits, closing its fd 9. Furthermore, the @@@ -181,7 -162,15 +181,15 @@@ test_expect_success 'background auto g # 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 &&