All of lore.kernel.org
 help / color / mirror / Atom feed
* strange date generated by git-format-patch
@ 2007-02-23  8:55 johan defries
  2007-02-23  9:04 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: johan defries @ 2007-02-23  8:55 UTC (permalink / raw)
  To: git

When I do

#git-format-patch --stdout HEAD^|head -1 | grep --color "Mon Sep 17
00:00:00 2001"

I really get a hit. "Sept 17 2001"?? It's strange, because the
repository is so much younger.

Can someone explain?

Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: strange date generated by git-format-patch
  2007-02-23  8:55 strange date generated by git-format-patch johan defries
@ 2007-02-23  9:04 ` Junio C Hamano
  2007-02-23 14:59   ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-02-23  9:04 UTC (permalink / raw)
  To: johan defries; +Cc: git

"johan defries" <johandefries@gmail.com> writes:

> When I do
>
> #git-format-patch --stdout HEAD^|head -1 | grep --color "Mon Sep 17
> 00:00:00 2001"
>
> I really get a hit. "Sept 17 2001"?? It's strange, because the
> repository is so much younger.

That is just a fake random date to make the Unix-From line
recognizable by common MUA and does not have anything to do with
your commit objects.

The real date is on Date: header.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: strange date generated by git-format-patch
  2007-02-23  9:04 ` Junio C Hamano
@ 2007-02-23 14:59   ` Johannes Schindelin
  2007-02-24  9:30     ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2007-02-23 14:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: johan defries, git

Hi,

On Fri, 23 Feb 2007, Junio C Hamano wrote:

> "johan defries" <johandefries@gmail.com> writes:
> 
> > When I do
> >
> > #git-format-patch --stdout HEAD^|head -1 | grep --color "Mon Sep 17
> > 00:00:00 2001"
> >
> > I really get a hit. "Sept 17 2001"?? It's strange, because the
> > repository is so much younger.
> 
> That is just a fake random date to make the Unix-From line recognizable 
> by common MUA and does not have anything to do with your commit objects.

So how about this:
-- snipsnap --
[PATCH] pretty=email: use current date for "From <sha1>" lines

To keep MUAs happy, we have to provide a date in mbox files. These
dates are supposed to mark the date of arrival, so take "now"
instead of some made-up date.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 log-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index ac86194..b6e1ad2 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -174,7 +174,7 @@ void show_log(struct rev_info *opt, const char *sep)
 		else
 			subject = "Subject: ";
 
-		printf("From %s Mon Sep 17 00:00:00 2001\n", sha1);
+		printf("From %s %s\n", sha1, show_date(time(NULL), 0, 0));
 		if (opt->message_id)
 			printf("Message-Id: <%s>\n", opt->message_id);
 		if (opt->ref_message_id)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: strange date generated by git-format-patch
  2007-02-23 14:59   ` Johannes Schindelin
@ 2007-02-24  9:30     ` Junio C Hamano
  2007-02-24 13:08       ` Theodore Tso
  2007-02-24 23:19       ` Johannes Schindelin
  0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-02-24  9:30 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: johan defries, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> That is just a fake random date to make the Unix-From line recognizable 
>> by common MUA and does not have anything to do with your commit objects.
>
> So how about this:

> @@ -174,7 +174,7 @@ void show_log(struct rev_info *opt, const char *sep)
>  		else
>  			subject = "Subject: ";
>  
> -		printf("From %s Mon Sep 17 00:00:00 2001\n", sha1);
> +		printf("From %s %s\n", sha1, show_date(time(NULL), 0, 0));

I actually once tried to change it to git's birthday (Thu Apr 7
15:13:13 2005 -0700) and I recall that it turned out that some
people's scripts (or perhaps MUA) were broken and cared what was
before "7" (nothing, as show_date() does, " " to align to two
columns per date, "0" to zero-pad align) on the Unix-From line
and discarded that update.

I do not think it is worth changing it.  Who's hurting with the
current behaviour?  In other words, is it broken?  Unix-From
lines are there only to separate each piece of e-mail in the
mbox and otherwise is not used.  send-email, am, nor imap-send
should care anything beyond the leading "From ", and mailsplit
validates only that what's around the last colon near the end of
line looks like time and year.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: strange date generated by git-format-patch
  2007-02-24  9:30     ` Junio C Hamano
@ 2007-02-24 13:08       ` Theodore Tso
  2007-02-24 18:51         ` Jeff King
  2007-02-24 23:19       ` Johannes Schindelin
  1 sibling, 1 reply; 7+ messages in thread
From: Theodore Tso @ 2007-02-24 13:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, johan defries, git

On Sat, Feb 24, 2007 at 01:30:17AM -0800, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> That is just a fake random date to make the Unix-From line recognizable 
> >> by common MUA and does not have anything to do with your commit objects.
> >
> I do not think it is worth changing it.  Who's hurting with the
> current behaviour?  In other words, is it broken?  Unix-From
> lines are there only to separate each piece of e-mail in the
> mbox and otherwise is not used.  send-email, am, nor imap-send
> should care anything beyond the leading "From ", and mailsplit
> validates only that what's around the last colon near the end of
> line looks like time and year.

The only potential problem with it is that some MUA's (like mutt for
example) sort by the From date by default.  You can force it to list
the patches in an unsorted order (via 'Ou'), but it might be nice if
the patches date in the From field was the date that the patches were
generated, with the seconds field bumped so that the patches in a
series were guaranteed to have monotonically increasing dates.  It's
only a minor point, though.

						- Ted

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: strange date generated by git-format-patch
  2007-02-24 13:08       ` Theodore Tso
@ 2007-02-24 18:51         ` Jeff King
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff King @ 2007-02-24 18:51 UTC (permalink / raw)
  To: Theodore Tso; +Cc: Junio C Hamano, Johannes Schindelin, johan defries, git

On Sat, Feb 24, 2007 at 08:08:39AM -0500, Theodore Tso wrote:

> The only potential problem with it is that some MUA's (like mutt for
> example) sort by the From date by default.  You can force it to list
> the patches in an unsorted order (via 'Ou'), but it might be nice if

That's not true; mutt sorts by date by default, but it pulls the default
from the "Date" header, which git correctly sets to the author timestamp.
You can convince mutt to look at the date in the 'From' line using a
'date-received' sort, but I don't know that it was ever the default.

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: strange date generated by git-format-patch
  2007-02-24  9:30     ` Junio C Hamano
  2007-02-24 13:08       ` Theodore Tso
@ 2007-02-24 23:19       ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-02-24 23:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: johan defries, git

Hi,

On Sat, 24 Feb 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> That is just a fake random date to make the Unix-From line 
> >> recognizable by common MUA and does not have anything to do with your 
> >> commit objects.
> >
> > So how about this:
> 
> > @@ -174,7 +174,7 @@ void show_log(struct rev_info *opt, const char *sep)
> >  		else
> >  			subject = "Subject: ";
> >  
> > -		printf("From %s Mon Sep 17 00:00:00 2001\n", sha1);
> > +		printf("From %s %s\n", sha1, show_date(time(NULL), 0, 0));
> 
> I actually once tried to change it to git's birthday (Thu Apr 7
> 15:13:13 2005 -0700) and I recall that it turned out that some
> people's scripts (or perhaps MUA) were broken and cared what was
> before "7" (nothing, as show_date() does, " " to align to two
> columns per date, "0" to zero-pad align) on the Unix-From line
> and discarded that update.

I only found out now (after some Googling, instigated by your reply) that 
the mbox format is _borked_. There seem to be so many variants, and I 
erroneously assumed that if it works in pine, it works everywhere...

> I do not think it is worth changing it.  Who's hurting with the
> current behaviour?  In other words, is it broken?

You can order by arrived-date. But that is such a minor issue that I agree 
nothing needs to be changed.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-02-24 23:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-23  8:55 strange date generated by git-format-patch johan defries
2007-02-23  9:04 ` Junio C Hamano
2007-02-23 14:59   ` Johannes Schindelin
2007-02-24  9:30     ` Junio C Hamano
2007-02-24 13:08       ` Theodore Tso
2007-02-24 18:51         ` Jeff King
2007-02-24 23:19       ` Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.