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

Re: [PATCHv2] builtin/merge: honor commit-msg hook for merges

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 6, 2017, 01:57 UTC
Message-ID
<xmqq4lsga8s7.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170905232953.22330-1-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 31 quoted lines
> Junio writes:
>> I didn't check how "merge --continue" is implemented, but we need to
>> behave exactly the same way over there, too.  Making sure that it is
>> a case in t7504 may be a good idea, in addition to the test you
>> added.
>
> After inspection of the code I do not think it is a good idea, because
> (a) it clutters the test suite with something "obvious" for now,
>     the call to cmd_commit will be the same as git-commit on the
>     command line and
> (b) piping through --[no-]verify would either introduce irregularities
>     ("Why do we pipe through --no-verify, when --sign-off is more important?")
>     or miss important options to pipe through: 
>
> 	static int continue_current_merge;
> ...
> 	OPT_BOOL(0, "continue", &continue_current_merge,
> 		N_("continue the current in-progress merge")),
> ...
> 	if (continue_current_merge) {
> 		int nargc = 1;
> 		const char *nargv[] = {"commit", NULL};
>
> 		if (orig_argc != 2)
> 			usage_msg_opt(_("--continue expects no arguments"),
> 			      builtin_merge_usage, builtin_merge_options);
>
> 		/* Invoke 'git commit' */
> 		ret = cmd_commit(nargc, nargv, prefix);
> 		goto done;
> 	}

That line of thought is backwards. 'something "obvious" for now' talks about the present. tests are all about future-proofing.

I also thought that we were hunting calls of cmd_foo() from outside the git.c command dispatcher as grave errors and want to clean up the codebase to get rid of them. So the above is the worst example to use when you are trying to convince why it needs no test---the above is a good example of the code that would need to change soon when we have enough volunteers willing to keep the codebase clean and healthy, and we would benefit from future-proofing tests.

Previous: Stefan BellerNext: Stefan Beller
Message 9 of 19 in “builtin/merge: honor commit-msg hook for merges”
  1. builtin/merge: honor commit-msg hook for mergesStefan Beller, Sep 5, 2017
  2. Junio C HamanoSep 5, 2017
  3. parse-options: warn developers on negated optionsStefan Beller, Sep 5, 2017
  4. Junio C HamanoSep 6, 2017
  5. Junio C HamanoSep 6, 2017
  6. Stefan BellerSep 6, 2017
  7. Junio C HamanoSep 6, 2017
  8. [PATCHv2] builtin/merge: honor commit-msg hook for mergesStefan Beller, Sep 5, 2017
  9. Junio C HamanoSep 6, 2017
  10. Stefan BellerSep 6, 2017
  11. Junio C HamanoSep 6, 2017
  12. [PATCHv3] builtin/merge: honor commit-msg hook for mergesStefan Beller, Sep 7, 2017
  13. Junio C HamanoSep 8, 2017
  14. Stefan BellerSep 11, 2017
  15. Kaartic SivaraamSep 16, 2017
  16. Stefan BellerSep 20, 2017
  17. Junio C HamanoSep 21, 2017
  18. Documentation/githooks: mention merge in commit-msg hookStefan Beller, Sep 21, 2017
  19. Junio C HamanoSep 22, 2017

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.