Skip to content

Commit

Permalink
Fix bug in install_lfs_hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
olsen232 committed Aug 23, 2022
1 parent 0a83984 commit a32ce41
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions kart/lfs_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
def install_lfs_hooks(repo):
pre_push_hook = repo.gitdir_path / "hooks" / "pre-push"
if not pre_push_hook.is_file():
pre_push_hook.parent.mkdir(parents=True, exist_ok=True)
pre_push_hook.write_text(PRE_PUSH_HOOK)
pre_push_hook.chmod(
pre_push_hook.stat().st_mode | stat.S_IXOTH | stat.S_IXGRP | stat.S_IXUSR
Expand Down
15 changes: 15 additions & 0 deletions tests/point_cloud/test_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from kart.repo import KartRepo
from kart.lfs_util import install_lfs_hooks


def test_install_lfs_hooks(tmp_path, cli_runner, chdir):
"""Create an empty Kart repository."""
repo_path = tmp_path / "repo"
repo_path.mkdir()

# empty dir
r = cli_runner.invoke(["init", str(repo_path)])
assert r.exit_code == 0, r

repo = KartRepo(repo_path)
install_lfs_hooks(repo)

0 comments on commit a32ce41

Please sign in to comment.