summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-08-05 01:02:41 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-08-05 01:02:41 +0000
commit2635c0e3b6d0fb7a48d892fe9528197eb13bc98b (patch)
tree3079d49ac2bc04a91ef35876c098fa57053edc75
parent43322283dc97b12e6d5b03c27fb780b0110f889a (diff)
parenteeab6860f1c5e542ebabdec2e44185bedad49ed7 (diff)
downloadgit-repo-2635c0e3b6d0fb7a48d892fe9528197eb13bc98b.tar.gz
Merge "Fix shallow clone behavior"
-rw-r--r--project.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/project.py b/project.py
index 9cb7542e..a117f4df 100644
--- a/project.py
+++ b/project.py
@@ -1877,6 +1877,13 @@ class Project(object):
1877 1877
1878 if depth: 1878 if depth:
1879 cmd.append('--depth=%s' % depth) 1879 cmd.append('--depth=%s' % depth)
1880 else:
1881 # If this repo has shallow objects, then we don't know which refs have
1882 # shallow objects or not. Tell git to unshallow all fetched refs. Don't
1883 # do this with projects that don't have shallow objects, since it is less
1884 # efficient.
1885 if os.path.exists(os.path.join(self.gitdir, 'shallow')):
1886 cmd.append('--depth=2147483647')
1880 1887
1881 if quiet: 1888 if quiet:
1882 cmd.append('--quiet') 1889 cmd.append('--quiet')
@@ -1914,16 +1921,6 @@ class Project(object):
1914 spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) 1921 spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch)))
1915 cmd.extend(spec) 1922 cmd.extend(spec)
1916 1923
1917 shallowfetch = self.config.GetString('repo.shallowfetch')
1918 if shallowfetch and shallowfetch != ' '.join(spec):
1919 GitCommand(self, ['fetch', '--depth=2147483647', name]
1920 + shallowfetch.split(),
1921 bare=True, ssh_proxy=ssh_proxy).Wait()
1922 if depth:
1923 self.config.SetString('repo.shallowfetch', ' '.join(spec))
1924 else:
1925 self.config.SetString('repo.shallowfetch', None)
1926
1927 ok = False 1924 ok = False
1928 for _i in range(2): 1925 for _i in range(2):
1929 gitcmd = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy) 1926 gitcmd = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy)