Skip to content

git-combine: attempt to clean up stale git lockfiles from crashed processes

Administrator requested to merge fix-git-combine into main

Created by: ggilmore

If git-combined crashes/restarts in the middle of a git operation, it can leave behind stale lockfiles (like index.lock, refs/remotes/origin/main.lock, etc. that can prevent git from running properly when the pod restarts:

/data/repos/gigarepo/.git # git gc
^Z[1]+  Stopped                    git gc
/data/repos/gigarepo/.git # kill %1
/data/repos/gigarepo/.git # git gc
fatal: gc is already running on machine 'git-combine-0' pid 10968 (use --force if not)

This PR attempts to remove all such "stale" git lockfiles when the daemon first starts, so that the pod avoids an endless crash loop.

Test plan

This is a PR for a utility command outside of the sourcegraph/sourcegraph codebase.

Merge request reports

Loading