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

Re: [BUG] Empty reflogs and "git log -g"

From
Junio C Hamano <junkio@cox.net>
Date
Feb 8, 2007, 23:18 UTC
Message-ID
<7vveicw850.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0702082040390.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 10 quoted lines
> On Thu, 8 Feb 2007, Jakub Narebski wrote:
>
>> StGIT used to produce no reflog messages; I don't know if this has 
>> improved. But you can have old reflog entries with empty messages; git 
>> log -g should deal with them IMHO.
>
> I just tried. An empty string is not enough. The tab before the message 
> has to be lacking, too.
>
> Here's a small patch, if you have to have it.

I think this is necessary for v1.5.0. I'd appreciate a properly signed-off log message.

Show 28 quoted lines
>
> ---
>
>  refs.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 7e07fc4..ba5bd2d 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1189,12 +1189,14 @@ int for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data)
>  		    !message || message[0] != ' ' ||
>  		    (message[1] != '+' && message[1] != '-') ||
>  		    !isdigit(message[2]) || !isdigit(message[3]) ||
> -		    !isdigit(message[4]) || !isdigit(message[5]) ||
> -		    message[6] != '\t')
> +		    !isdigit(message[4]) || !isdigit(message[5]))
>  			continue; /* corrupt? */
>  		email_end[1] = '\0';
>  		tz = strtol(message + 1, NULL, 10);
> -		message += 7;
> +		if (message[6] != '\t')
> +			message += 6;
> +		else
> +			message += 7;
>  		ret = fn(osha1, nsha1, buf+82, timestamp, tz, message, cb_data);
>  		if (ret)
>  			break;
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 9 of 13 in “[BUG] Empty reflogs and "git log -g"”
  1. Santi BéjarFeb 8, 2007
  2. Santi BéjarFeb 8, 2007
  3. Johannes SchindelinFeb 8, 2007
  4. Nicolas PitreFeb 8, 2007
  5. Johannes SchindelinFeb 8, 2007
  6. Johannes SchindelinFeb 8, 2007
  7. Jakub NarebskiFeb 8, 2007
  8. Johannes SchindelinFeb 8, 2007
  9. Junio C HamanoFeb 8, 2007
  10. for_each_reflog_ent: be forgiving about missing messageJohannes Schindelin, Feb 8, 2007
  11. log --reflog: use dwim_logJohannes Schindelin, Feb 9, 2007
  12. Junio C HamanoFeb 9, 2007
  13. Junio C HamanoFeb 9, 2007

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.