Skip to content

Commit a170e60

Browse files
Remove protocol.version 1 shallow cloning
1 parent e748da2 commit a170e60

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pre_commit/store.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ def _complete_clone(self, ref, git_cmd):
142142
git_cmd('checkout', ref)
143143
git_cmd('submodule', 'update', '--init', '--recursive')
144144

145-
def _shallow_clone(self, ref, protocol_version, git_cmd):
145+
def _shallow_clone(self, ref, git_cmd):
146146
"""Perform a shallow clone of a repository and its submodules """
147147

148-
git_config = 'protocol.version={}'.format(protocol_version)
148+
git_config = 'protocol.version=2'
149149
git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
150150
git_cmd('checkout', ref)
151151
git_cmd(
@@ -169,12 +169,9 @@ def _git_cmd(*args):
169169
_git_cmd('remote', 'add', 'origin', repo)
170170

171171
try:
172-
self._shallow_clone(ref, 2, _git_cmd)
172+
self._shallow_clone(ref, _git_cmd)
173173
except CalledProcessError:
174-
try:
175-
self._shallow_clone(ref, 1, _git_cmd)
176-
except CalledProcessError:
177-
self._complete_clone(ref, _git_cmd)
174+
self._complete_clone(ref, _git_cmd)
178175

179176
return self._new_repo(repo, ref, deps, clone_strategy)
180177

0 commit comments

Comments
 (0)