Hi Steve,
On Thu, 3 Dec 2026 at 02:28, Steve <stev…@gmail.com> wrote:
> That only happens when the lock is removed by hand. The command would
> remove both files, after a short wait for a command that has just
> taken the lock but not yet written its PID file.
The old PID file can already be there before anyone runs the command.
Before Git 2.54, Git's own error message told users to remove index.lock
by hand. Once someone does that, every Git process that takes the lock
runs without its own PID file, and the short wait isn't helpful, because that
process never writes one.
The command could catch this by checking if the PID file is older
than index.lock, since Git writes the PID file right after it takes
the lock.
> Could it store the hostname, like gc.pid does?
I think it could, and it's not a new idea. Torsten asked for the
hostname when the PID file was first sent [1], and the file was kept
as "pid <value>" so that more fields could be added later [2].
gc.pid already does this. It stores the hostname next to the PID, and
if the gc is running on another machine, it doesn't check the PID and
treats it as still running.
[1] https://lore.kernel.org/git/2025…@tb-raspi4/
[2] https://lore.kernel.org/git/pull…@gmail.com/
Thanks,
Tanga