mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Fix autoupdate to always use non-shallow clone
This commit is contained in:
parent
95afd642f5
commit
73250ff4e3
4 changed files with 29 additions and 21 deletions
|
|
@ -156,18 +156,13 @@ class Store(object):
|
|||
def clone(self, repo, ref, deps=()):
|
||||
"""Clone the given url and checkout the specific ref."""
|
||||
|
||||
if os.path.isdir(repo):
|
||||
repo = os.path.abspath(repo)
|
||||
|
||||
def clone_strategy(directory):
|
||||
git.init_repo(directory, repo)
|
||||
env = git.no_git_env()
|
||||
|
||||
def _git_cmd(*args):
|
||||
cmd_output('git', *args, cwd=directory, env=env)
|
||||
|
||||
_git_cmd('init', '.')
|
||||
_git_cmd('remote', 'add', 'origin', repo)
|
||||
|
||||
try:
|
||||
self._shallow_clone(ref, _git_cmd)
|
||||
except CalledProcessError:
|
||||
|
|
@ -193,8 +188,7 @@ class Store(object):
|
|||
def _git_cmd(*args):
|
||||
cmd_output('git', *args, cwd=directory, env=env)
|
||||
|
||||
_git_cmd('init', '.')
|
||||
_git_cmd('config', 'remote.origin.url', '<<unknown>>')
|
||||
git.init_repo(directory, '<<unknown>>')
|
||||
_git_cmd('add', '.')
|
||||
git.commit(repo=directory)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue