mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Revert of git_cache.py: Clobber git repos if the config is corrupt (patchset #4 id:60001 of https://codereview.chromium.org/2031773002/ )
Reason for revert:
Suspected to break builds: http://crbug.com/618124
Original issue's description:
> git_cache.py: Clobber git repos if the config is corrupt
>
> See https://build.chromium.org/p/tryserver.chromium.win/builders/win10_chromium_x64_rel_ng_exp/builds/1801/steps/bot_update/logs/stdio
> [Mirror] https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.win%2Fwin10_chromium_x64_rel_ng_exp%2F1801%2F%2B%2Frecipes%2Fsteps%2Fbot_update%2F0%2Fstdout
>
> Sometimes repos become corrupt and bot_update fails spectacularly. This usually happens due to the process being interrupted during a fetch. Git
> cache should be able to recover from this by clobbering.
>
> BUG=
>
> Committed: b48b126ffd
TBR=estaab@chromium.org,phajdan.jr@chromium.org,hinoka@google.com,hinoka@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=
Review-Url: https://codereview.chromium.org/2049463003
This commit is contained in:
committed by
Commit bot
parent
b48b126ffd
commit
0f4ee8193b
12
git_cache.py
12
git_cache.py
@@ -38,7 +38,7 @@ except NameError:
|
||||
class LockError(Exception):
|
||||
pass
|
||||
|
||||
class ClobberNeeded(Exception):
|
||||
class RefsHeadsFailedToFetch(Exception):
|
||||
pass
|
||||
|
||||
class Lockfile(object):
|
||||
@@ -246,11 +246,7 @@ class Mirror(object):
|
||||
cwd = self.mirror_path
|
||||
|
||||
# Don't run git-gc in a daemon. Bad things can happen if it gets killed.
|
||||
try:
|
||||
self.RunGit(['config', 'gc.autodetach', '0'], cwd=cwd)
|
||||
except subprocess.CalledProcessError:
|
||||
# Hard error, need to clobber.
|
||||
raise ClobberNeeded()
|
||||
self.RunGit(['config', 'gc.autodetach', '0'], cwd=cwd)
|
||||
|
||||
# Don't combine pack files into one big pack file. It's really slow for
|
||||
# repositories, and there's no way to track progress and make sure it's
|
||||
@@ -411,7 +407,7 @@ class Mirror(object):
|
||||
self.RunGit(fetch_cmd + [spec], cwd=rundir, retry=True)
|
||||
except subprocess.CalledProcessError:
|
||||
if spec == '+refs/heads/*:refs/heads/*':
|
||||
raise ClobberNeeded() # Corrupted cache.
|
||||
raise RefsHeadsFailedToFetch
|
||||
logging.warn('Fetch of %s failed' % spec)
|
||||
|
||||
def populate(self, depth=None, shallow=False, bootstrap=False,
|
||||
@@ -430,7 +426,7 @@ class Mirror(object):
|
||||
tempdir = self._ensure_bootstrapped(depth, bootstrap)
|
||||
rundir = tempdir or self.mirror_path
|
||||
self._fetch(rundir, verbose, depth)
|
||||
except ClobberNeeded:
|
||||
except RefsHeadsFailedToFetch:
|
||||
# This is a major failure, we need to clean and force a bootstrap.
|
||||
gclient_utils.rmtree(rundir)
|
||||
self.print(GIT_CACHE_CORRUPT_MESSAGE)
|
||||
|
||||
Reference in New Issue
Block a user