Am 24.04.2016 um 23:18 schrieb Ævar Arnfjörð Bjarmason:
+test_expect_success 'set up a pre-commit hook in core.hooksPath' ' + mkdir -p .git/custom-hooks .git/hooks && + write_script .git/custom-hooks/pre-commit <<EOF && +printf "%s" "." >>.git/PRE-COMMIT-HOOK-WAS-CALLED +EOF + cat >.git/hooks/pre-commit <<EOF && + write_script .git/hooks/pre-commit && +printf "%s" "SHOULD NOT BE CALLED" >>.git/PRE-COMMIT-HOOK-WAS-CALLED +EOF + chmod +x .git/custom-hooks/pre-commit
Here I see a half-baked attempt to use write_script. Once you've fixed that, we have a pre-commit hook in the regular hook directory. Obviously, the hook is expected not to be called...
+' + +test_expect_success 'Check that various forms of specifying core.hooksPath work' ' + test_commit no_custom_hook &&
... but at this point, it *will* be called...
+ git config core.hooksPath .git/custom-hooks && + test_commit have_custom_hook && + git config core.hooksPath .git/custom-hooks/ && + test_commit have_custom_hook_trailing_slash && + git config core.hooksPath "$PWD/.git/custom-hooks" && + test_commit have_custom_hook_abs_path && + git config core.hooksPath "$PWD/.git/custom-hooks/" && + test_commit have_custom_hook_abs_path_trailing_slash && + printf "%s" "...." >.git/PRE-COMMIT-HOOK-WAS-CALLED.expect &&
... and this expectation is wrong.
+ test_cmp .git/PRE-COMMIT-HOOK-WAS-CALLED.expect .git/PRE-COMMIT-HOOK-WAS-CALLED +' + +test_done
I feel a bit uneasy that expected and actual files are not POSIXly correct text files, i.e., the LF at the end is missing...
-- Hannes -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html