From: Johannes Sixt <j6t@kdbg.org>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [PATCH v2] hooks: Add ability to specify where the hook directory is
Date: Mon, 25 Apr 2016 21:11:11 +0200 [thread overview]
Message-ID: <571E6BCF.5020606@kdbg.org> (raw)
In-Reply-To: <1461532702-4045-1-git-send-email-avarab@gmail.com>
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
next prev parent reply other threads:[~2016-04-25 19:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 23:33 [PATCH] hooks: Add ability to specify where the hook directory is Ævar Arnfjörð Bjarmason
2016-04-23 0:13 ` SZEDER Gábor
2016-04-23 0:44 ` Ævar Arnfjörð Bjarmason
2016-04-24 21:18 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2016-04-25 14:19 ` Ævar Arnfjörð Bjarmason
2016-04-25 19:11 ` Johannes Sixt [this message]
2016-04-25 20:33 ` Junio C Hamano
2016-04-26 16:31 ` Ævar Arnfjörð Bjarmason
2016-04-26 19:16 ` Junio C Hamano
2016-04-26 19:19 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=571E6BCF.5020606@kdbg.org \
--to=j6t@kdbg.org \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder@ira.uka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.