# strange date generated by git-format-patch

7 messages from 2007-02-23 to 2007-02-24. Participants: johan defries, Junio C Hamano, Johannes Schindelin, Theodore Tso, Jeff King.
Thread: https://gitlist.dev/t/6926

## johan defries, 2007-02-23 08:55

Subject: strange date generated by git-format-patch
Message-ID: <38d46eb0702230055i587bc775r9362aafeef803976@mail.gmail.com>
URL: https://gitlist.dev/e/38d46eb0702230055i587bc775r9362aafeef803976%40mail.gmail.com

```
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.

```

## Junio C Hamano, 2007-02-23 09:04

Subject: Re: strange date generated by git-format-patch
Message-ID: <7vtzxd6y9h.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vtzxd6y9h.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <38d46eb0702230055i587bc775r9362aafeef803976@mail.gmail.com>

```
"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.

```

## Johannes Schindelin, 2007-02-23 14:59

Subject: Re: strange date generated by git-format-patch
Message-ID: <Pine.LNX.4.63.0702231558170.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0702231558170.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vtzxd6y9h.fsf@assigned-by-dhcp.cox.net>

```
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)

```

## Junio C Hamano, 2007-02-24 09:30

Subject: Re: strange date generated by git-format-patch
Message-ID: <7vodnjzyvq.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vodnjzyvq.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0702231558170.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
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.

```

## Theodore Tso, 2007-02-24 13:08

Subject: Re: strange date generated by git-format-patch
Message-ID: <20070224130839.GC4380@thunk.org>
URL: https://gitlist.dev/e/20070224130839.GC4380%40thunk.org
In-Reply-To: <7vodnjzyvq.fsf@assigned-by-dhcp.cox.net>

```
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

```

## Jeff King, 2007-02-24 18:51

Subject: Re: strange date generated by git-format-patch
Message-ID: <20070224185150.GB2646@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20070224185150.GB2646%40coredump.intra.peff.net
In-Reply-To: <20070224130839.GC4380@thunk.org>

```
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

```

## Johannes Schindelin, 2007-02-24 23:19

Subject: Re: strange date generated by git-format-patch
Message-ID: <Pine.LNX.4.63.0702250010080.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0702250010080.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vodnjzyvq.fsf@assigned-by-dhcp.cox.net>

```
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

```
