Commit 2f38df65 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

gclient: Reset the fetch config also when --force is passed.

The update_scripts step doesn't set '--reset'
Additionally, if there was no fetch config, don't fail trying to unset it.

Tbr: agable@chromium.org
No-Try: True
Bug: 862547
Change-Id: I90886ca7d1dd20ae59b378a5998de47dc67c60f9
Reviewed-on: https://chromium-review.googlesource.com/1137693
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent 455ee3a6
......@@ -1209,7 +1209,7 @@ class GitWrapper(SCMWrapper):
def _SetFetchConfig(self, options):
"""Adds, and optionally fetches, "branch-heads" and "tags" refspecs
if requested."""
if options.reset:
if options.force or options.reset:
try:
self._Run(['config', '--unset-all', 'remote.%s.fetch' % self.remote],
options)
......
......@@ -316,7 +316,13 @@ class Mirror(object):
cwd = self.mirror_path
if reset_fetch_config:
self.RunGit(['config', '--unset-all', 'remote.origin.fetch'], cwd=cwd)
try:
self.RunGit(['config', '--unset-all', 'remote.origin.fetch'], cwd=cwd)
except subprocess.CalledProcessError as e:
# If exit code was 5, it means we attempted to unset a config that
# didn't exist. Ignore it.
if e.returncode != 5:
raise
# Don't run git-gc in a daemon. Bad things can happen if it gets killed.
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment