mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1077 from pre-commit/shallow_fetch_fetch_head
Fix shallow fetch by checking out FETCH_HEAD
This commit is contained in:
commit
927b2ab3f8
1 changed files with 4 additions and 4 deletions
|
|
@ -142,15 +142,15 @@ class Store(object):
|
|||
git_cmd('checkout', ref)
|
||||
git_cmd('submodule', 'update', '--init', '--recursive')
|
||||
|
||||
def _shallow_clone(self, ref, git_cmd): # pragma: windows no cover
|
||||
def _shallow_clone(self, ref, git_cmd):
|
||||
"""Perform a shallow clone of a repository and its submodules """
|
||||
|
||||
git_config = 'protocol.version=2'
|
||||
git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
|
||||
git_cmd('checkout', ref)
|
||||
git_cmd('checkout', 'FETCH_HEAD')
|
||||
git_cmd(
|
||||
'-c', git_config, 'submodule', 'update', '--init',
|
||||
'--recursive', '--depth=1',
|
||||
'-c', git_config, 'submodule', 'update', '--init', '--recursive',
|
||||
'--depth=1',
|
||||
)
|
||||
|
||||
def clone(self, repo, ref, deps=()):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue