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

Re: [PATCH] git-blame: Make the output human readable

From
Junio C Hamano <junkio@cox.net>
Date
Mar 5, 2006, 12:10 UTC
Message-ID
<7vbqwlgkhk.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060305110351.GA23448@c165.ib.student.liu.se>
Fredrik Kuivinen <freku045@student.liu.se> writes:
> The default output mode is slightly different from git-annotate's.
> However, git-annotate's output mode can be obtained by using the
> '-c' flag.

It might be better to default to human readable and make the script consumption format an option, if only to reduce typing.

Show 12 quoted lines
> diff --git a/Makefile b/Makefile
> index b6d8804..eb1887d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -534,6 +534,10 @@ git-rev-list$X: rev-list.o $(LIB_FILE)
>  	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
>  		$(LIBS) $(OPENSSL_LIBSSL)
>  
> +git-blame$X: blame.o $(LIB_FILE)
> +	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
> +		$(LIBS) -lm
> +
I wonder what it is about to link this binary different from others...
Show 9 quoted lines
> +char* format_time(unsigned long time, const char* tz)
> +{
> +	static char time_buf[128];
> +	time_t t = time;
> +
> +	strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S ", gmtime(&t));
> +	strcat(time_buf, tz);
> +	return time_buf;
> +}

I think this shows GMT with time offset, which is compatible with the human readable time Johannes did to git-annotate. I do not know what timezone CVS annotate shows its dates offhand (it seems to only show dates). Johannes, is this an attempt to match what CVS does?

I am wondering if we want to be in line with the date formatting convention used for our commits and tags, that is, to show local timestamp with timezone. The code to use would be show_date() from date.c if we go that route.

Previous: Fredrik KuivinenNext: Fredrik Kuivinen
Message 2 of 10 in “git-blame: Make the output human readable”
  1. git-blame: Make the output human readableFredrik Kuivinen, Mar 5, 2006
  2. Junio C HamanoMar 5, 2006
  3. Fredrik KuivinenMar 5, 2006
  4. Johannes SchindelinMar 5, 2006
  5. Junio C HamanoMar 5, 2006
  6. Fredrik KuivinenMar 7, 2006
  7. blame: avoid -lm by not using log().Junio C Hamano, Mar 5, 2006
  8. Johannes SchindelinMar 5, 2006
  9. blame and annotate: show localtime with timezone.Junio C Hamano, Mar 5, 2006
  10. Johannes SchindelinMar 5, 2006

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.