From a4a850aa7bcd18558542b4b539ab20fad6a5f062 Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Tue, 16 Jul 2024 20:48:07 +0000 Subject: [PATCH] Prevent sync from deleting existing non-git-sources when in cog. Bug:b/353461856 Change-Id: I08e6a27fdbcc445629898422ee04449376911a0c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5713190 Commit-Queue: Joanna Wang Reviewed-by: Stephanie Kim Auto-Submit: Joanna Wang Commit-Queue: Stephanie Kim --- gclient.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gclient.py b/gclient.py index bdfe98df3..4042ac831 100755 --- a/gclient.py +++ b/gclient.py @@ -840,7 +840,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): # Check if at least one object needs to be downloaded. needs_download = any(gcs.IsDownloadNeeded() for gcs in gcs_deps) - if needs_download and os.path.exists(gcs_deps[0].output_dir): + # When IsEnvCog(), gcs sources are already present and are not managed by gclient. + if not gclient_utils.IsEnvCog( + ) and needs_download and os.path.exists(gcs_deps[0].output_dir): # Since we don't know what old content to remove, we remove # the entire output_dir. All gcs_deps are expected to have # the same output_dir, so we get the first one, which must