diff options
author | LaMont Jones <lamontjones@google.com> | 2022-06-01 21:03:34 +0000 |
---|---|---|
committer | LaMont Jones <lamontjones@google.com> | 2022-06-08 16:49:08 +0000 |
commit | ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460 (patch) | |
tree | c0ffaeea5ed6ccee683f47e6cef5a8897b130cb7 /project.py | |
parent | bdcba7dc36f1c8e6041681eb5b3b5229c93c7c5c (diff) | |
download | git-repo-ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460.tar.gz |
Only sync superproject if it will be used.
If the user says `--no-use-superproject`, then do not bother syncing the
superproject.
Also add/update docstrings and comments throughout.
Change-Id: I9cdad706130501bab9a22d3099a1dae605e9c194
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/338975
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -33,6 +33,7 @@ import fetch | |||
33 | from git_command import GitCommand, git_require | 33 | from git_command import GitCommand, git_require |
34 | from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \ | 34 | from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \ |
35 | ID_RE | 35 | ID_RE |
36 | import git_superproject | ||
36 | from git_trace2_event_log import EventLog | 37 | from git_trace2_event_log import EventLog |
37 | from error import GitError, UploadError, DownloadError | 38 | from error import GitError, UploadError, DownloadError |
38 | from error import ManifestInvalidRevisionError, ManifestInvalidPathError | 39 | from error import ManifestInvalidRevisionError, ManifestInvalidPathError |
@@ -2180,6 +2181,8 @@ class Project(object): | |||
2180 | if prune: | 2181 | if prune: |
2181 | cmd.append('--prune') | 2182 | cmd.append('--prune') |
2182 | 2183 | ||
2184 | # Always pass something for --recurse-submodules, git with GIT_DIR behaves | ||
2185 | # incorrectly when not given `--recurse-submodules=no`. (b/218891912) | ||
2183 | cmd.append(f'--recurse-submodules={"on-demand" if submodules else "no"}') | 2186 | cmd.append(f'--recurse-submodules={"on-demand" if submodules else "no"}') |
2184 | 2187 | ||
2185 | spec = [] | 2188 | spec = [] |
@@ -3486,8 +3489,8 @@ class ManifestProject(MetaProject): | |||
3486 | git_event_log: an EventLog, for git tracing. | 3489 | git_event_log: an EventLog, for git tracing. |
3487 | """ | 3490 | """ |
3488 | # TODO(lamontjones): when refactoring sync (and init?) consider how to | 3491 | # TODO(lamontjones): when refactoring sync (and init?) consider how to |
3489 | # better get the init options that we should use when syncing uncovers a new | 3492 | # better get the init options that we should use for new submanifests that |
3490 | # submanifest. | 3493 | # are added when syncing an existing workspace. |
3491 | git_event_log = git_event_log or EventLog() | 3494 | git_event_log = git_event_log or EventLog() |
3492 | spec = submanifest.ToSubmanifestSpec() | 3495 | spec = submanifest.ToSubmanifestSpec() |
3493 | # Use the init options from the existing manifestProject, or the parent if | 3496 | # Use the init options from the existing manifestProject, or the parent if |
@@ -3874,8 +3877,8 @@ class ManifestProject(MetaProject): | |||
3874 | ) | 3877 | ) |
3875 | 3878 | ||
3876 | # Lastly, if the manifest has a <superproject> then have the superproject | 3879 | # Lastly, if the manifest has a <superproject> then have the superproject |
3877 | # sync it if it will be used. | 3880 | # sync it (if it will be used). |
3878 | if self.manifest.superproject: | 3881 | if git_superproject.UseSuperproject(use_superproject, self.manifest): |
3879 | sync_result = self.manifest.superproject.Sync(git_event_log) | 3882 | sync_result = self.manifest.superproject.Sync(git_event_log) |
3880 | if not sync_result.success: | 3883 | if not sync_result.success: |
3881 | print('warning: git update of superproject for ' | 3884 | print('warning: git update of superproject for ' |