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

Re: [PATCH] Fix empty line processing in git-shortlog.perl

From
Junio C Hamano <junkio@cox.net>
Date
Nov 7, 2005, 02:56 UTC
Message-ID
<7v3bm9upx4.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051106224218.22797.97260.stgit@machine.or.cz>
Petr Baudis <pasky@suse.cz> writes:
Show 15 quoted lines
> Faced with a commit such as
>
> 	commit f1b2646c7f2713c3ea4bce120e1d0d8091808be4
> 	Author: Adrian Bunk <bunk@r063144.stusta.swh.mhn.de>
> 	Date:   Sun Nov 6 20:30:38 2005 +0100
>
> 	    From: Michal Wronski <wrona@mat.uni.torun.pl>
>
> 	    I've jchanged my email. Please apply this patch so as to everybody
> 	    could send me a remarks about mqueuefs.
>
> 	    Signed-off-by: Michal Wronski <Michal.Wronski@motorola.com>
> 	    Signed-off-by: Adrian Bunk <bunk@stusta.de>
>
> git-shortlog.perl would produce a line with an empty commit title.
> This patch fixes that...
> -			next unless /^\s*?(.*)/;
> +			next unless /^\s*?(\S.*)$/;

I suspect /(\S.*)$/ would do the same thing, but in any case I do not think it is the right fix.

I think the problem is deeper than that. Shortlog summarizes to only one line per commit, so I suspect what you would be feeding it would say something like this for the above example:

        commit f1b2646c7f2713c3ea4bce120e1d0d8091808be4
        Author: Adrian Bunk <bunk@r063144.stusta.swh.mhn.de>
            From: Michal Wronski <wrona@mat.uni.torun.pl>

That is, the commit you quoted is done by 'git log --pretty', but a typical shortlog invocation would be:

	git log --pretty=short rev1..rev2 | git shortlog
With or without your fix, the command barfs.

Of course, that "From: " line should have been used as the commit author by the tool that created the commit out of e-mail Adrian received, but that is a separate issue.

Previous: Petr BaudisNext: Petr Baudis
Message 3 of 4 in “Fix empty line processing in git-shortlog.perl”
  1. Fix empty line processing in git-shortlog.perlPetr Baudis, Nov 6, 2005
  2. Petr BaudisNov 6, 2005
  3. Junio C HamanoNov 7, 2005
  4. Petr BaudisNov 7, 2005

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.