Subject: Re: [PATCH v6] lockfile: add PID file for debugging stale locks

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 6 Feb 2026 17:27:41 +0100

On Thu, Jan 22, 2026 at 07:23:35PM +0000, Paulo Casaretto via GitGitGadget wrote:
> diff --git a/t/t0031-lockfile-pid.sh b/t/t0031-lockfile-pid.sh
> new file mode 100755
> index 0000000000..8ef87addf5
> --- /dev/null
> +++ b/t/t0031-lockfile-pid.sh
> @@ -0,0 +1,105 @@
> +#!/bin/sh
> +
> +test_description='lock file PID info tests
> +
> +Tests for PID info file alongside lock files.
> +The feature is opt-in via core.lockfilePid config setting (boolean).
> +'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'stale lock detected when PID is not running' '
> +	git init repo &&
> +	(
> +		cd repo &&
> +		touch .git/index.lock &&
> +		printf "pid 99999" >.git/index~pid.lock &&
> +		test_must_fail git -c core.lockfilePid=true add . 2>err &&
> +		test_grep "process 99999, which is no longer running" err &&
> +		test_grep "appears to be stale" err
> +	)
> +'
> +
> +test_expect_success 'PID info not shown by default' '
> +	git init repo2 &&

Nit, not really worth addressing on its own: you could avoid the
numbering if you used `test_when_finished rm -rf repo`.

Other than that I don't have any complaints from the ref side anymore,
and the code seems sensible to me. Thanks!

Patrick