Revert "git-cache: contains_revision returns False if sentient file exists"

This reverts commit 5a267a66a6.

Reason for revert: Causing gclient sync failures: https://ci.chromium.org/ui/p/chromeos/builders/staging/staging-amd64-generic-msan-fuzzer/b8716255278944170913

Bug: 41488725
Original change's description:
> git-cache: contains_revision returns False if sentient file exists
>
> If git_cache.populate() gets interrupted midway, it can possibly leave
> a git mirror in a state where only some commits are available. Cloning
> such a repo results in an empty repository and causes subsequent git
> checkout to fail.
>
> If the sentient file exists, it indicates that the bootstrapping
> process was interrupted. This CL updates git_cache.contains_revision()
> such that it returns False if the sentient file exists. Then,
> the caller can call mirror.populate() to re-populate the repo/rev.
>
> Bug: 41488725
> Change-Id: I24fd24e300f5a9f9349589496d6b5f3dacf71fd2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6491733
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>

Bug: 41488725
Change-Id: I50f3ce5f0b6802db5969546d43a4fe1ab2dcf3c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6497449
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Auto-Submit: Andrew Lamb <andrewlamb@chromium.org>
This commit is contained in:
Andrew Lamb
2025-04-29 09:38:37 -07:00
committed by LUCI CQ
parent 4edb194e91
commit 550706e9f4

View File

@@ -317,14 +317,6 @@ class Mirror(object):
if not self.exists():
return False
# If the cache population is in progress, this will raise LockError().
with lockfile.lock(self.mirror_path, timeout=0):
# If the sentinent file exists at this point, it indicates that
# the bootstrapping process was interrupted, leaving the cache
# entries in a bad state.
if os.path.isfile(self._init_sentient_file):
return False
if sys.platform.startswith('win'):
# Windows .bat scripts use ^ as escape sequence, which means we have
# to escape it with itself for every .bat invocation.