mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-10-21 12:48:28 +00:00
sync: keep smart sync override with -l
Splitting a sync into `repo sync -n` followed by `repo sync -l` should end up in the same state as a single `repo sync`. With smart sync it does not always: -n fetches the revisions pinned by the smart sync manifest and saves it as smart_sync_override.xml, but the following -l deletes that override and checks out ToT instead, unless the manifest sets sync-smartsync="true". So `repo sync -s -n` + `repo sync -l` lands on ToT, while `repo sync -s` lands on the pinned revisions. Without an explicit -s or -t, -l does not contact the manifest server, so it cannot choose new pins itself; the only consistent choice is to keep the override the previous -n left behind. Do that regardless of the manifest default. Syncs that choose a manifest themselves still replace or remove the override as before: any sync without -l, and -l combined with -s, -t, -m, --superproject-revision or --no-smart-sync. Smart sync stays non-sticky for regular syncs, and `repo sync -l --no-smart-sync` still discards the override to check out ToT. Bug: 569927750 Change-Id: Id06ff88e9f3183fae32e993e86630fc3e8de71a1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/640965 Commit-Queue: Rahul Yadav <yadavrah@google.com> Tested-by: Rahul Yadav <yadavrah@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
1 parent
beda65323e
commit
178b66ee3e
3 files changed
+51
-41
No files matched your search
+6
-5
@@ -2499,17 +2499,18 @@ later is required to fix a server side protocol bug.
|
||||
if opt.clone_bundle is None:
|
||||
opt.clone_bundle = manifest.CloneBundle
|
||||
|
||||
# An onboarded client run with -l keeps the smart sync manifest it last
|
||||
# synced to instead of contacting the manifest server. Computed before
|
||||
# _ResolveSmartSyncOption, which makes an unset opt.smart_sync
|
||||
# indistinguishable from --no-smart-sync.
|
||||
# Without an explicit smart sync option, -l does not contact the
|
||||
# manifest server, so it keeps the smart sync manifest the client last
|
||||
# synced to, whether that came from -s or from the manifest's
|
||||
# sync-smartsync default. This keeps `sync -n` + `sync -l` equivalent
|
||||
# to a single sync. Computed before _ResolveSmartSyncOption, which
|
||||
# makes an unset opt.smart_sync indistinguishable from --no-smart-sync.
|
||||
reuse_smart_sync_override = (
|
||||
opt.local_only
|
||||
and opt.smart_sync is None
|
||||
and not opt.smart_tag
|
||||
and not opt.manifest_name
|
||||
and not opt.superproject_revision
|
||||
and getattr(manifest.default, "sync_smartsync", False) is True
|
||||
and os.path.isfile(smart_sync_manifest_path)
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user