mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-17 12:09:27 +00:00
unseen: make clone disk-size guard tolerate git's mid-walk churn
disk_bytes() summed the clone tree with rglob + stat() as a size cap before every git command. On a blob:none clone, `git show` triggers an on-demand blob fetch that writes and deletes transient .git/objects/pack/*.rev files, so a path rglob had just listed could be gone by the stat() call -> FileNotFoundError aborted the whole draft as an instrument_failure. The race can hit any candidate, so it was a non-deterministic draft-killer (observed extracting a real npm repo). Skip a file that raises OSError mid-walk; the size cap is unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0a637e8989
commit
f4c7143525
@@ -57,7 +57,16 @@ class Git:
|
||||
return done.stdout.decode("utf-8", errors="replace")
|
||||
|
||||
def disk_bytes(self) -> int:
|
||||
return sum(p.stat().st_size for p in self.path.rglob("*") if p.is_file() and not p.is_symlink())
|
||||
# git churns .git/objects/pack (incl. transient *.rev) during on-demand blob
|
||||
# fetches, so a path rglob just listed can vanish before stat(): skip it.
|
||||
total = 0
|
||||
for p in self.path.rglob("*"):
|
||||
try:
|
||||
if p.is_file() and not p.is_symlink():
|
||||
total += p.stat().st_size
|
||||
except OSError:
|
||||
continue
|
||||
return total
|
||||
|
||||
def parents(self, sha: str) -> list[str]:
|
||||
return self.run("rev-list", "--parents", "-n", "1", sha).split()[1:]
|
||||
|
||||
Reference in New Issue
Block a user