Web lists-archives.com

Re: [PATCH 1/1] t6500(mingw): use the Windows PID of the shell




On Tue, May 7, 2019 at 5:51 PM Johannes Schindelin via GitGitGadget
<gitgitgadget@xxxxxxxxx> wrote:
> [...]
> Let's fix this by making sure that the Windows PID is written into
> `gc.pid` in this test script soo that `git.exe` is able to understand
> that that process does indeed still exist.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
> @@ -162,7 +162,15 @@ test_expect_success 'background auto gc respects lock for all operations' '
> +       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 &&

I wonder if it would make sense to abstract this away behind a shell
function named shell_pid() which can be specialized for MINGW, much
like the shell function pwd() is specialized on Windows.