sync: don't let --nmu affect smart sync

--no-manifest-update has always meant "use the existing manifest
checkout as-is": it skips updating .repo/manifests and nothing else.
Smart sync pins do not come from that checkout but from the manifest
server, and an explicit `-s --nmu` already works that way.

The manifest-driven default smart sync (sync-smartsync="true") instead
treated --nmu like -l: it disabled the implicit smart sync and kept an
existing smart_sync_override.xml. So on such manifests `repo sync --nmu`
fetched and checked out the previous pins (or ToT if there were none)
instead of doing what `repo sync` does minus the manifest checkout
update.

Make --nmu orthogonal to smart sync again: it no longer disables the
default smart sync, and it no longer keeps the override. Both have to
change together; otherwise a failed implicit smart sync under --nmu
would fall back to ToT while leaving the override on disk. Only -l,
which skips fetching, keeps the override.

Bug: 569927750
Change-Id: I33730363df485d72cd86ae99bf5eb8399b58e81a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/641264
Reviewed-by: Brian Gan <brgan@google.com>
Commit-Queue: Rahul Yadav <yadavrah@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Tested-by: Rahul Yadav <yadavrah@google.com>
This commit is contained in:
Rahul Yadav authored and gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com committed 2026-10-09 07:00:22 -07:00
1 parent 7bba4ee47e
commit 0a4e68f9d2
3 files changed
+55 -20

No files matched your search

+5 -6
View File
@@ -2432,7 +2432,6 @@ later is required to fix a server side protocol bug.
and not opt.manifest_name
and not opt.superproject_revision
and not opt.local_only
and opt.mp_update
and getattr(manifest.default, "sync_smartsync", False) is True
)
if opt.smart_sync is None:
@@ -2459,12 +2458,12 @@ 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 or --no-manifest-update 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.
# 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.
reuse_smart_sync_override = (
(opt.local_only or not opt.mp_update)
opt.local_only
and opt.smart_sync is None
and not opt.smart_tag
and not opt.manifest_name