mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-05-07 11:29:27 +00:00
project: don't re-shallow manually unshallowed repos during sync
If a user has manually unshallowed a repo (e.g. via `git fetch --unshallow`), the absence of the `shallow` file in the gitdir indicates a full clone. Re-applying depth during a subsequent sync would undo the user's intent. Skip re-shallowing in this case by clearing depth when the project is not new and no shallow file is present. Change-Id: I4ee0e78018de9078fe1bd77a9615613ef0c40d33 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/558743 Reviewed-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Carlos Fernandez <carlosfsanz@meta.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Lucas Alves <ltanure@gmail.com> Tested-by: Lucas Alves <ltanure@gmail.com> Reviewed-by: Lucas Alves <ltanure@gmail.com>
This commit is contained in:
@@ -1391,6 +1391,15 @@ class Project:
|
||||
else:
|
||||
depth = self.manifest.manifestProject.depth
|
||||
|
||||
# If the project has been manually unshallowed (e.g. via
|
||||
# `git fetch --unshallow`), don't re-shallow it during sync.
|
||||
if (
|
||||
depth
|
||||
and not is_new
|
||||
and not os.path.exists(os.path.join(self.gitdir, "shallow"))
|
||||
):
|
||||
depth = None
|
||||
|
||||
if depth and clone_filter_for_depth:
|
||||
depth = None
|
||||
clone_filter = clone_filter_for_depth
|
||||
|
||||
Reference in New Issue
Block a user