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

Re: [PATCH] Get format-patch to show first commit after root commit

From
APAlexander Potashev <aspotashev@gmail.com>
Date
Jan 10, 2009, 11:36 UTC
Message-ID
<20090110113642.GA25723@myhost>
In-Reply-To
<7vmye0yohu.fsf@gitster.siamese.dyndns.org>
Hello, Junio!
Show 9 quoted lines
> I think the attached would be a better patch.  We already have a
> configuration to control if we show the patch for a root commit by
> default, and we can use reuse it here.  The configuration defaults to true
> these days.
> 
> Because the code before the hunk must check if the user said "--root
> commit" or just "commit" from the command line and behave quite
> differently by looking at rev.show_root_diff, we cannot do this assignment
> before the command line parsing like other commands in the log family.

I think the problem was not only format-patch misbehaviour. If you use "log.showroot = no", you still get an empty patch file, which is not very good, because format-patch doesn't work very well, it creates _corrupt_ patches! It's much better to not create the patch file at all in this case.

However, it has nothing in common with your patch, but there's room for another commit.

Show 23 quoted lines
> 
>  builtin-log.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git c/builtin-log.c w/builtin-log.c
> index 4a02ee9..2d2c111 100644
> --- c/builtin-log.c
> +++ w/builtin-log.c
> @@ -935,6 +935,14 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  		 * get_revision() to do the usual traversal.
>  		 */
>  	}
> +
> +	/*
> +	 * We cannot move this anywhere earlier because we do want to
> +	 * know if --root was given explicitly from the comand line.
> +	 */
> +	if (default_show_root)
> +		rev.show_root_diff = 1;
> +
>  	if (cover_letter) {
>  		/* remember the range */
>  		int i;
Previous: Nathan W. PanikeNext: Alexander Potashev
Message 4 of 11 in “Get format-patch to show first commit after root commit”
  1. Get format-patch to show first commit after root commitNathan W. Panike, Jan 9, 2009
  2. Junio C HamanoJan 10, 2009
  3. Nathan W. PanikeJan 10, 2009
  4. Alexander PotashevJan 10, 2009
  5. format-patch: avoid generation of empty patchesAlexander Potashev, Jan 10, 2009
  6. Nathan W. PanikeJan 10, 2009
  7. Alexander PotashevJan 10, 2009
  8. Nathan W. PanikeJan 10, 2009
  9. Junio C HamanoJan 10, 2009
  10. Add new testcases for format-patch root commitsAlexander Potashev, Jan 10, 2009
  11. Alexander PotashevJan 10, 2009

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.