Find a busy git in the runtime by its path as well as its name
The wait before clearing a stale shallow.lock looked for a git whose command line began with `git`, so one started as `/usr/bin/git`, which is what a caller that resolved it with `which` runs, was never seen: its lock, once a minute old, would have been cleared under it and a second fetch started against the same shallow file. The path is allowed only ahead of the name, at the start of the command line, so a process that merely names git in an argument, an editor opened on /usr/bin/git from inside the runtime say, is not waited for. Co-Authored-By: Codex XHigh <noreply@openai.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bffe142ce
commit
72608aed85
2 files changed
+21
-2
No files matched your search
@@ -286,7 +286,7 @@ git_dir_of() {
|
||||
git_busy_in_runtime() {
|
||||
local pid cwd dir real
|
||||
real=$(realpath -e -- "$runtime" 2>/dev/null) || return 1
|
||||
for pid in $(pgrep -u "$(id -u)" -f '^git(-remote-[a-z]+)?( |$)' 2>/dev/null); do
|
||||
for pid in $(pgrep -u "$(id -u)" -f '^([^ ]*/)?git(-remote-[a-z]+)?( |$)' 2>/dev/null); do
|
||||
cwd=$(readlink "/proc/$pid/cwd" 2>/dev/null) || continue
|
||||
if [[ $cwd == "$real" || $cwd == "$real/"* ]]; then
|
||||
return 0
|
||||
|
||||
Reference in new issue
Block a user