public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail•com>
Cc: git@vger•kernel.org, Jacob Keller <jacob.keller@gmail•com>,
	Eric Sunshine <sunshine@sunshineco•com>,
	Johannes Sixt <j6t@kdbg•org>
Subject: Re: [PATCH v5 0/4] githooks.txt improvements + core.hooksDirectory
Date: Wed, 04 May 2016 15:13:24 -0700	[thread overview]
Message-ID: <xmqqa8k5eakb.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1462393128-26762-1-git-send-email-avarab@gmail.com> ("Ævar	Arnfjörð Bjarmason"'s message of "Wed, 4 May 2016 20:18:44 +0000")

Ævar Arnfjörð Bjarmason  <avarab@gmail•com> writes:

> For convenience & ease of review a diff between the bits of v4 and v5
> that I changed follows below.

Thanks.

> diff --git a/Documentation/config.txt b/Documentation/config.txt
> ...
> +This configuration variable is useful in cases where you'd like to
> +centrally configure your Git hooks instead of configuring them on a
> +per-repository basis, or as a more flexible and centralized
> +alterantive to having an `init.templateDir` where you've changed

"alternative" (can be locally amended).

> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
> ...
> +Hooks don't need to worry about the user's current working
> +directory. Before Git invokes a hook it changes its working
> +directory. The working directory will be the root of the working tree
> +in a non-bare repository, or in the $GIT_DIR directory in a bare
> +repository.

I suspect that the first sentence does more harm than good.  When
you say "don't need to worry about", somebody is bound to ask "that
is good that I do not need to, but what if I _want_ to know?", and
you do not have a good answer to that question.

	Before Git invokes a hook, it changes its working directory
	to either the root of the working tree in a non-bare
	repository, or to the $GIT_DIR in a bare repository.

perhaps?

> diff --git a/t/t1350-config-hooks-path.sh b/t/t1350-config-hooks-path.sh
> index f2f0aa9..6e4586a 100755
> --- a/t/t1350-config-hooks-path.sh
> +++ b/t/t1350-config-hooks-path.sh
> @@ -7,10 +7,10 @@ test_description='Test the core.hooksPath configuration variable'
>  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" "CUST" >>.git/PRE-COMMIT-HOOK-WAS-CALLED
> +	echo CUSTOM >>actual
>  EOF
>  	write_script .git/hooks/pre-commit <<-\EOF
> -printf "%s" "NORM" >>.git/PRE-COMMIT-HOOK-WAS-CALLED
> +	echo NORMAL >>actual
>  EOF
>  '

These closing EOF can and should be indented like the body of the
here-text, i.e.

	cmd <<-\EOF &&
        ...
        EOF

> @@ -24,8 +24,14 @@ test_expect_success 'Check that various forms of specifying core.hooksPath work'
>  	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" "NORMCUSTCUSTCUSTCUST" >.git/PRE-COMMIT-HOOK-WAS-CALLED.expect &&
> -	test_cmp .git/PRE-COMMIT-HOOK-WAS-CALLED.expect .git/PRE-COMMIT-HOOK-WAS-CALLED
> +	cat >expect <<-\EOF &&
> +	NORMAL
> +	CUSTOM
> +	CUSTOM
> +	CUSTOM
> +	CUSTOM
> +EOF

Likewise.

  parent reply	other threads:[~2016-05-04 22:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 18:13 [PATCH v4 0/4] githooks.txt improvements + core.hooksDirectory Ævar Arnfjörð Bjarmason
2016-04-26 18:13 ` [PATCH v4 1/4] githooks.txt: Improve the intro section Ævar Arnfjörð Bjarmason
2016-04-26 19:48   ` Junio C Hamano
2016-04-26 18:13 ` [PATCH v4 2/4] githooks.txt: Amend dangerous advice about 'update' hook ACL Ævar Arnfjörð Bjarmason
2016-04-26 19:49   ` Junio C Hamano
2016-04-26 18:13 ` [PATCH v4 3/4] githooks.txt: Minor improvements to the grammar & phrasing Ævar Arnfjörð Bjarmason
2016-04-26 18:13 ` [PATCH v4 4/4] hooks: Add ability to specify where the hook directory is Ævar Arnfjörð Bjarmason
2016-04-26 19:55   ` Junio C Hamano
2016-05-04 20:18     ` [PATCH v5 0/4] githooks.txt improvements + core.hooksDirectory Ævar Arnfjörð Bjarmason
2016-05-04 20:18       ` [PATCH v5 1/4] githooks.txt: Improve the intro section Ævar Arnfjörð Bjarmason
2016-05-04 20:18       ` [PATCH v5 2/4] githooks.txt: Amend dangerous advice about 'update' hook ACL Ævar Arnfjörð Bjarmason
2016-05-04 20:18       ` [PATCH v5 3/4] githooks.txt: Minor improvements to the grammar & phrasing Ævar Arnfjörð Bjarmason
2016-05-04 20:18       ` [PATCH v5 4/4] hooks: Add ability to specify where the hook directory is Ævar Arnfjörð Bjarmason
2016-05-04 22:13       ` Junio C Hamano [this message]
2016-05-04 22:58         ` [PATCH v6 0/4] githooks.txt improvements + core.hooksDirectory Ævar Arnfjörð Bjarmason
2016-05-04 22:58           ` [PATCH v6 1/4] githooks.txt: Improve the intro section Ævar Arnfjörð Bjarmason
2016-05-04 22:58           ` [PATCH v6 2/4] githooks.txt: Amend dangerous advice about 'update' hook ACL Ævar Arnfjörð Bjarmason
2016-05-04 22:58           ` [PATCH v6 3/4] githooks.txt: Minor improvements to the grammar & phrasing Ævar Arnfjörð Bjarmason
2016-05-04 22:58           ` [PATCH v6 4/4] hooks: Add ability to specify where the hook directory is Ævar Arnfjörð Bjarmason
2016-05-04 23:26           ` [PATCH v6 0/4] githooks.txt improvements + core.hooksDirectory Junio C Hamano

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=xmqqa8k5eakb.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=avarab@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=j6t@kdbg$(echo .)org \
    --cc=jacob.keller@gmail$(echo .)com \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox