mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 15:28:28 +01:00
hooks: checkout: fix incorrect dvc repo detection
When running from non-root directory `git ls-files .dvc` will treat it as a relative path to the current location, so if you run `git checkout` from a directory that is not a git/dvc root, our hook will think that it is being run in a non-dvc repo and will do nothing. To fix that, need to use `--full-name` flag.
This commit is contained in:
@@ -250,7 +250,7 @@ class Git(Base):
|
||||
def _install_hook(self, name, cmd):
|
||||
command = (
|
||||
'[ "$3" = "0" ]'
|
||||
' || [ -z "$(git ls-files .dvc)" ]'
|
||||
' || [ -z "$(git ls-files --full-name .dvc)" ]'
|
||||
" || exec dvc {}".format(cmd)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user