mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
@@ -216,7 +216,11 @@ class Git(Base):
|
||||
return [t.name for t in self.repo.tags]
|
||||
|
||||
def _install_hook(self, name, cmd):
|
||||
command = '[ -z "$(git ls-files .dvc)" ] || exec dvc {}'.format(cmd)
|
||||
command = (
|
||||
'[ "$3" == "0" ]'
|
||||
' || [ -z "$(git ls-files .dvc)" ]'
|
||||
" || exec dvc {}".format(cmd)
|
||||
)
|
||||
|
||||
hook = os.path.join(self.root_dir, self.GIT_DIR, "hooks", name)
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ class TestInstall(object):
|
||||
expected_script = (
|
||||
"#!/bin/sh\n"
|
||||
"echo hello\n"
|
||||
'[ -z "$(git ls-files .dvc)" ] || exec dvc checkout\n'
|
||||
'[ "$3" == "0" ]'
|
||||
' || [ -z "$(git ls-files .dvc)" ]'
|
||||
" || exec dvc checkout\n"
|
||||
)
|
||||
|
||||
with open(self._hook("post-checkout"), "r") as fobj:
|
||||
@@ -51,7 +53,9 @@ class TestInstall(object):
|
||||
|
||||
expected_script = (
|
||||
"#!/bin/sh\n"
|
||||
'[ -z "$(git ls-files .dvc)" ] || exec dvc checkout\n'
|
||||
'[ "$3" == "0" ]'
|
||||
' || [ -z "$(git ls-files .dvc)" ]'
|
||||
" || exec dvc checkout\n"
|
||||
)
|
||||
|
||||
with open(self._hook("post-checkout"), "r") as fobj:
|
||||
|
||||
Reference in New Issue
Block a user