mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
sync: respect --force-sync when fetching updates
If a tag is rewritten on the server (which is bad), trying to recover
locally with `repo sync --force-sync` doesn't actually work. People
have to manually delete things themselves to fix syncing. While tags
should never be rewritten in practice, allow users to easily recover
from broken servers.
We updated some of these code paths already (see commit 6e53844f1e
"Allow clobbering of existing tags from remote."), but the incremental
update flow was missed.
Bug: b/120778183
Bug: chromium:932651
Test: delete local tag & recreate to diff commit, then check
`repo sync` & `repo sync --force-sync` behavior
Change-Id: I3648f7d2526732c06016b691a9a36c003157618d
This commit is contained in:
parent
01019d94af
commit
e57f1146de
@ -1306,7 +1306,7 @@ class Project(object):
|
||||
not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
|
||||
current_branch_only=current_branch_only,
|
||||
no_tags=no_tags, prune=prune, depth=depth,
|
||||
submodules=submodules)):
|
||||
submodules=submodules, force_sync=force_sync)):
|
||||
return False
|
||||
|
||||
mp = self.manifest.manifestProject
|
||||
@ -1955,7 +1955,8 @@ class Project(object):
|
||||
no_tags=False,
|
||||
prune=False,
|
||||
depth=None,
|
||||
submodules=False):
|
||||
submodules=False,
|
||||
force_sync=False):
|
||||
|
||||
is_sha1 = False
|
||||
tag_name = None
|
||||
@ -2068,6 +2069,9 @@ class Project(object):
|
||||
else:
|
||||
cmd.append('--tags')
|
||||
|
||||
if force_sync:
|
||||
cmd.append('--force')
|
||||
|
||||
if prune:
|
||||
cmd.append('--prune')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user