project: Speculative fix for project corruption

When a new shared project is added to manifest, there's a short window
where objects can be deleted that are used by other projects.

To close that window, set preciousObjects during git init. For
non-shared projects, repo should correct the state in the same execution
instance.

Bug: 288102993
Change-Id: I366f524535ac58c820d51a88599ae2108df9ab48
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390234
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Tested-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Josip Sokcevic
2023-10-19 14:46:11 -07:00
committed by LUCI
parent ae824fb2fc
commit 9267d58727
2 changed files with 11 additions and 2 deletions

View File

@ -1129,8 +1129,6 @@ later is required to fix a server side protocol bug.
)
project.config.SetString("gc.pruneExpire", "never")
else:
if not opt.quiet:
print(f"\r{relpath}: not shared, disabling pruning.")
project.config.SetString("extensions.preciousObjects", None)
project.config.SetString("gc.pruneExpire", None)