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

Re: [PATCH] merge-message: change meaning of "empty merge message"

From
Kevin Daudt <me@ikke.info>
Date
Jul 6, 2017, 04:46 UTC
Message-ID
<20170706044640.GA11020@alpha.vpn.ikke.info>
In-Reply-To
<20170706033149.6275-1-kaarticsivaraam91196@gmail.com>
On Thu, Jul 06, 2017 at 09:01:49AM +0530, Kaartic Sivaraam wrote:
Show 29 quoted lines
> In the context of "git merge" the meaning of an "empty message"
> is one that contains no line of text. This is not in line with
> "git commit" where an "empty message" is one that contains only
> whitespaces and/or signed-off-by lines. This could cause surprises
> to users who are accustomed to the meaning of an "empty message"
> of "git commit".
> 
> Prevent such surprises by changing the meaning of an empty 'merge
> message' to be in line with that of an empty 'commit message'.
> 
> Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
> ---
>  builtin/merge.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/builtin/merge.c b/builtin/merge.c
> index 703827f00..db4bf1c40 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -748,6 +748,39 @@ static void abort_commit(struct commit_list *remoteheads, const char *err_msg)
>  	exit(1);
>  }
>  
> +/*
> + * Find out if the message in the strbuf contains only whitespace and
> + * Signed-off-by lines.
> + *
> + * This function is the "rest_is_space" function of "commit" with the unwanted
> + * parameter removed.
The function is called "rest_is_empty".

But isn't it better that commit and merge use the same code, instead of duplicating it again? Otherwise one may be updated, and the other forgotten, getting differences in behaviur, which is what you want to solve.

Kevin
Previous: Kaartic SivaraamNext: Kaartic Sivaraam
Message 5 of 24 in “Why doesn't merge fail if message has only sign-off?”
  1. Kaartic SivaraamJul 2, 2017
  2. Junio C HamanoJul 3, 2017
  3. Kaartic SivaraamJul 4, 2017
  4. merge-message: change meaning of "empty merge message"Kaartic Sivaraam, Jul 6, 2017
  5. Kevin DaudtJul 6, 2017
  6. Kaartic SivaraamJul 6, 2017
  7. commit & merge: modularize the empty message validatorKaartic Sivaraam, Jul 11, 2017
  8. Kaartic SivaraamJul 11, 2017
  9. Junio C HamanoJul 11, 2017
  10. Kaartic SivaraamJul 13, 2017
  11. Junio C HamanoJul 13, 2017
  12. Kaartic SivaraamJul 14, 2017
  13. Christian BrabandtJul 17, 2017
  14. Junio C HamanoJul 17, 2017
  15. Kaartic SivaraamJul 13, 2017
  16. Junio C HamanoJul 13, 2017
  17. Kaartic SivaraamJul 14, 2017
  18. Kaartic SivaraamJul 15, 2017
  19. branch: change the error messages to be more meaningfulKaartic Sivaraam, Aug 21, 2017
  20. Kaartic SivaraamAug 21, 2017
  21. commit: change the meaning of an empty commit messageKaartic Sivaraam, Aug 21, 2017
  22. Junio C HamanoAug 24, 2017
  23. Kaartic SivaraamAug 31, 2017
  24. Kaartic SivaraamOct 2, 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.