Skip to content

Commit fa68311

Browse files
committed
Anchor git-gc proc matches to start of line, further tightening
Additional enhancements to reduce the likelihood of false positive matches causing backups to fail after the GC cooldown window is exceeded. These should be much more resilient to matching either "gc" or "nw-repack" in other commands. The changes here introduce the following new rules for matching gc / repack processes::w - Only match "git" at the beginning of the line. Verified all GC / nw-repack invocations follow this pattern. - Match either "git gc" or "git --opts ... gc" but require a space before the subcommand (gc / nw-repack) in either case. i.e. Don't match "git somethingc". - Match "git ... gc" where "gc" is anchored at end of line. - Match "git gc --opts" where gc is followed by a space.
1 parent 263ebf2 commit fa68311

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

share/github-backup-utils/ghe-backup-repositories-rsync

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ echo "
7676
while [ \$sanity -lt $GHE_GIT_COOLDOWN_PERIOD ]; do
7777
# note: the bracket synta[x] below is to prevent matches against the
7878
# grep process itself.
79-
if ps axo pid,args | grep -q -e 'git[ -].*nw-repac[k]' -e 'git[ -].*g[c]'; then
79+
if ps axo args | grep -q -E -e '^git( -.*)? nw-repac[k]( |$)' -e '^git( -.*)? g[c]( |$)'; then
8080
sleep 1
8181
sanity=\$(( sanity + 1 ))
8282
else

0 commit comments

Comments
 (0)