Merge "Implementation of manifest defined githooks"
diff --git a/project.py b/project.py
index 68bc7bd..68d7421 100644
--- a/project.py
+++ b/project.py
@@ -1728,6 +1728,9 @@
depth = self.clone_depth
else:
depth = self.manifest.manifestProject.config.GetString('repo.depth')
+ # The repo project should never be synced with partial depth
+ if self.relpath == '.repo/repo':
+ depth = None
if depth:
current_branch_only = True
@@ -1801,9 +1804,7 @@
cmd = ['fetch']
- # The --depth option only affects the initial fetch; after that we'll do
- # full fetches of changes.
- if depth and initial:
+ if depth:
cmd.append('--depth=%s' % depth)
if quiet:
@@ -1852,10 +1853,24 @@
ok = False
for _i in range(2):
- ret = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy).Wait()
+ gitcmd = GitCommand(self, cmd, bare=True, capture_stderr=True,
+ ssh_proxy=ssh_proxy)
+ ret = gitcmd.Wait()
+ print(gitcmd.stderr, file=sys.stderr, end='')
if ret == 0:
ok = True
break
+ # If needed, run the 'git remote prune' the first time through the loop
+ elif (not _i and
+ "error:" in gitcmd.stderr and
+ "git remote prune" in gitcmd.stderr):
+ prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True,
+ capture_stderr=True, ssh_proxy=ssh_proxy)
+ ret = prunecmd.Wait()
+ print(prunecmd.stderr, file=sys.stderr, end='')
+ if ret:
+ break
+ continue
elif current_branch_only and is_sha1 and ret == 128:
# Exit code 128 means "couldn't find the ref you asked for"; if we're in sha1
# mode, we just tried sync'ing from the upstream field; it doesn't exist, thus
diff --git a/subcmds/sync.py b/subcmds/sync.py
index b1945d5..2bdab3a 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -128,6 +128,9 @@
The --fetch-submodules option enables fetching Git submodules
of a project from server.
+The -c/--current-branch option can be used to only fetch objects that
+are on the branch specified by a project's revision.
+
SSH Connections
---------------