mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Remove protocol.version 1 shallow cloning
This commit is contained in:
parent
e748da2abe
commit
a170e60daa
1 changed files with 4 additions and 7 deletions
|
|
@ -142,10 +142,10 @@ class Store(object):
|
||||||
git_cmd('checkout', ref)
|
git_cmd('checkout', ref)
|
||||||
git_cmd('submodule', 'update', '--init', '--recursive')
|
git_cmd('submodule', 'update', '--init', '--recursive')
|
||||||
|
|
||||||
def _shallow_clone(self, ref, protocol_version, git_cmd):
|
def _shallow_clone(self, ref, git_cmd):
|
||||||
"""Perform a shallow clone of a repository and its submodules """
|
"""Perform a shallow clone of a repository and its submodules """
|
||||||
|
|
||||||
git_config = 'protocol.version={}'.format(protocol_version)
|
git_config = 'protocol.version=2'
|
||||||
git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
|
git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
|
||||||
git_cmd('checkout', ref)
|
git_cmd('checkout', ref)
|
||||||
git_cmd(
|
git_cmd(
|
||||||
|
|
@ -169,12 +169,9 @@ class Store(object):
|
||||||
_git_cmd('remote', 'add', 'origin', repo)
|
_git_cmd('remote', 'add', 'origin', repo)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._shallow_clone(ref, 2, _git_cmd)
|
self._shallow_clone(ref, _git_cmd)
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
try:
|
self._complete_clone(ref, _git_cmd)
|
||||||
self._shallow_clone(ref, 1, _git_cmd)
|
|
||||||
except CalledProcessError:
|
|
||||||
self._complete_clone(ref, _git_cmd)
|
|
||||||
|
|
||||||
return self._new_repo(repo, ref, deps, clone_strategy)
|
return self._new_repo(repo, ref, deps, clone_strategy)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue