git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] sequencer: run post-commit hook

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 11, 2019, 04:27 UTC
Message-ID
<xmqqftjzj49u.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.1910102324140.46@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 13 quoted lines
>> diff --git a/builtin/commit.c b/builtin/commit.c
>> index d898a57f5d..adb8c89c60 100644
>> --- a/builtin/commit.c
>> +++ b/builtin/commit.c
>> @@ -1653,7 +1653,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>>
>>  	repo_rerere(the_repository, 0);
>>  	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
>> -	run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
>> +	run_post_commit_hook(use_editor, get_index_file());
>
> Does it really make sense to abstract the hook name away? It adds a lot
> of churn for just two callers...
After looking at the three patches, I do not think so.
Show 18 quoted lines
>> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
>> index d2f1d5bd23..d9217235b6 100755
>> --- a/t/t3404-rebase-interactive.sh
>> +++ b/t/t3404-rebase-interactive.sh
>> @@ -1467,4 +1467,21 @@ test_expect_success 'valid author header when author contains single quote' '
>>  	test_cmp expected actual
>>  '
>>
>> +test_expect_success 'post-commit hook is called' '
>> +	test_when_finished "rm -f .git/hooks/post-commit commits" &&
>> +	mkdir -p .git/hooks &&
>> +	write_script .git/hooks/post-commit <<-\EOS &&
>> +	git rev-parse HEAD >>commits
>
> Should `commits` be initialized before this script is written, e.g.
> using
>
> 	>commits &&
Yes.
Show 8 quoted lines
>> +	git rev-list --no-walk=unsorted HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} \
>> +		HEAD@{1} HEAD >expected &&
>
> Wouldn't this be better as:
>
> 	git rev-parse HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} HEAD@{1} HEAD \
> 		>expect &&
>
Yes.
>> +	test_cmp expected commits
>
> We usually use the name `expect` instead of `expected` in the test
> suite.
And the actual output file is called 'actual'.
Thanks.
Previous: Johannes SchindelinNext: Phillip Wood
Message 10 of 20 in “sequencer: start running post-commit hook again”
  1. 0/3 sequencer: start running post-commit hook againPhillip Wood via GitGitGadget, Oct 10, 2019
  2. 2/3 sequencer: use run_commit_hook()Phillip Wood via GitGitGadget, Oct 10, 2019
  3. Johannes SchindelinOct 10, 2019
  4. Junio C HamanoOct 11, 2019
  5. Phillip WoodOct 14, 2019
  6. Johannes SchindelinOct 14, 2019
  7. 1/3 sequencer.h fix placement of #endifPhillip Wood via GitGitGadget, Oct 10, 2019
  8. 3/3 sequencer: run post-commit hookPhillip Wood via GitGitGadget, Oct 10, 2019
  9. Johannes SchindelinOct 10, 2019
  10. Junio C HamanoOct 11, 2019
  11. Phillip WoodOct 11, 2019
  12. 0/6 sequencer: start running post-commit hook againPhillip Wood via GitGitGadget, Oct 15, 2019
  13. 1/6 t3404: remove unnecessary subshellPhillip Wood via GitGitGadget, Oct 15, 2019
  14. 2/6 t3404: set $EDITOR in subshellPhillip Wood via GitGitGadget, Oct 15, 2019
  15. 3/6 t3404: remove uneeded calls to set_fake_editorPhillip Wood via GitGitGadget, Oct 15, 2019
  16. 6/6 sequencer: run post-commit hookPhillip Wood via GitGitGadget, Oct 15, 2019
  17. 4/6 sequencer.h fix placement of #endifPhillip Wood via GitGitGadget, Oct 15, 2019
  18. 5/6 move run_commit_hook() to libgit and use it therePhillip Wood via GitGitGadget, Oct 15, 2019
  19. Johannes SchindelinOct 15, 2019
  20. Junio C HamanoOct 16, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.