Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lfs/hook: teach lfs.Hook about core.hooksPath #1409

Merged
merged 4 commits into from Aug 2, 2016

Conversation

ttaylorr
Copy link
Contributor

@ttaylorr ttaylorr commented Aug 1, 2016

This commit gives the lfs.Hook knowledge of the new core.hooksPath
configuration value that was introduce in Git 2.9.0.

When core.HooksPath is found in the Git configuration AND is supported (i.e.,
installed Git binary has a version greater than or equal to "2.9.0"), git-lfs install will place new hooks in that directory. If the core.hooksPath is
specified, but the installed verison of Git does NOT support it, then it will
be ignored and installed in .git/hooks as per usual.

To test this behavior, two new shell tests were added:

  • One that runs on Git >= 2.9.0, and tests that core.hooksPath is respected
  • One that runs on Git < 2.9.0, and tests that core.hooksPath is ignored

Unfortunately, our current testing framework does not support skipping
individual tests, only skipping entire files, so two new shell test files were
added.

Resolves #1407.


/cc @technoweenie

This commit gives the `lfs.Hook` knowledge of the new `core.hooksPath`
configuration value that was introduce in Git 2.9.0.

When `core.HooksPath` is found in the Git configuration AND is supported (i.e.,
installed Git binary has a version greater than or equal to "2.9.0"), `git-lfs
install` will place new hooks in that directory. If the `core.hooksPath` is
specified, but the installed verison of Git does NOT support it, then it will
be ignored and installed in `.git/hooks` as per usual.

To test this behavior, two new shell tests were added:
  - One that runs on Git >= 2.9.0, and tests that `core.hooksPath` is respected
  - One that runs on Git < 2.9.0, and tests that `core.hooksPath` is ignored

Unfortunately, our current testing framework does not support skipping
individual tests, only skipping entire files, so two new shell test files were
added.

Resolves #1407.
git lfs install 2>&1 | tee install.log
grep "Updated pre-push hook" install.log

[ -e "$hooks_dir/pre-push" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have [ ! -e ".git/hooks/pre-push" ] too? Also, both tests misspell "perform" :)

@technoweenie technoweenie merged commit ac301aa into master Aug 2, 2016
@technoweenie technoweenie deleted the install-custom-hooks-path branch August 2, 2016 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants