stabilize FUSE git reset recovery (#8825)

This commit is contained in:
Chris Lu
2026-03-29 00:04:32 -07:00
committed by GitHub
parent 43f5916a1d
commit ce02cf3c9d

View File

@@ -431,6 +431,17 @@ func resetToCommitWithRecovery(t *testing.T, bareRepo, localClone, mountClone, c
} }
continue continue
} }
// Verify git commands actually work in the directory — the kernel
// dcache can transiently show the dir then lose it after reset.
if _, err := tryGitCommand(mountClone, "rev-parse", "HEAD"); err != nil {
lastErr = fmt.Errorf("post-reset verification failed: %w", err)
if attempt < maxAttempts {
t.Logf("reset recovery attempt %d: %v — removing clone for re-create", attempt, lastErr)
os.RemoveAll(mountClone)
time.Sleep(2 * time.Second)
}
continue
}
return return
} }
require.NoError(t, lastErr, "git reset --hard %s failed after %d recovery attempts", commit, maxAttempts) require.NoError(t, lastErr, "git reset --hard %s failed after %d recovery attempts", commit, maxAttempts)