Skip to content

pre-commit hook updates

Øystein Walle git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2t7503: use write_script to generate hook scriptst/t7503-pre-commit-hook.sh+3 -65 replies
2/2commit: inform pre-commit that --amend was usedDocumentation/githooks.txt builtin/commit.c t/t7503-pre-commit-hook.sh+15 -21 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] pre-commit hook updates

The first patch changes t/t7503-pre-commit-hook.sh to use write_script everywhere, as was suggested by Jeff King in the discussion of the previous patch.

The second patch is v2 of the patch I sent earlier. I've incorporated Eric Sunshine's suggestions. I didn't do enough digging; I found test_expect_failure and assumed this was test_expect_success's twin brother, but it marked stuff as known breakages so I went with the '!'. I also found it a bit strange that test_must_fail has a different signature (to the extent a shell function has one at all). Is my use of test_must_fail correct?

I agree with Junio Hamano that it's better to provide no argument at all rather than an empty one. I also agree with Jeff King that "noamend" is better than an empty argument. I went with the second one since Jeff seemed to get the last word :)

I'm not sure I like the ternary inside the function call like that, but I went with it because it gave the smallest footprint (which is probably not a good argument). I suppose I could have done:

if (amend)

	hook_arg1 = "amend"

else
hook_arg1 = "noamend"
...
... run_commit_hook(use_editor, index_file, "pre-commit", hook_arg1, NULL);

or create a hook_amend variable.

I'm happy to send a v3.

Øystein Walle (2):
t7503: use write_script to generate hook scripts
commit: inform pre-commit that --amend was used

 Documentation/githooks.txt |  3 ++-
 builtin/commit.c           |  3 ++-
 t/t7503-pre-commit-hook.sh | 20 ++++++++++++++------
 3 files changed, 18 insertions(+), 8 deletions(-)
Signature · 1 line
2.2.0.rc2.23.gca0107e