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

[PATCH 0/2] pre-commit hook updates

From
Øystein Walle <oystwa@gmail.com>
Date
Nov 25, 2014, 22:51 UTC
Message-ID
<cover.1416953772.git.oystwa@gmail.com>

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(-)
-- 
2.2.0.rc2.23.gca0107e
Next: Øystein Walle
Message 1 of 13 in “pre-commit hook updates”
  1. 0/2 pre-commit hook updatesØystein Walle, Nov 25, 2014
  2. 1/2 t7503: use write_script to generate hook scriptsØystein Walle, Nov 25, 2014
  3. Eric SunshineNov 26, 2014
  4. Jeff KingNov 26, 2014
  5. Junio C HamanoNov 26, 2014
  6. Jeff KingNov 26, 2014
  7. Junio C HamanoNov 26, 2014
  8. 2/2 commit: inform pre-commit that --amend was usedØystein Walle, Nov 25, 2014
  9. Eric SunshineNov 26, 2014
  10. Eric SunshineNov 26, 2014
  11. Jeff KingNov 26, 2014
  12. Junio C HamanoNov 26, 2014
  13. Jeff KingNov 26, 2014

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.