threads / discuss / 12815

git-cvsserver: log dates ignore timezone

Subject: git-cvsserver: log dates ignore timezone

## tl;dr

One message between Mar 23, 2008 and Mar 23, 2008.

replies: 0people: 1as markdown or json

Bruno Haible· Mar 23, 2008, 10:36 UTC · lore
Hi,

In the "cvs log" output produced by git-cvsserver, the revision dates lack the time zone, making it appear that sometimes newer commits were done at older dates. For example, in the gnulib repository, "cvs log ChangeLog" shows:

   ----------------------------
   revision 1.2444
   date: 2008/03/20 09:24:13;  author: Eric;  state: Exp;  lines: +2 -3
   ...
   ----------------------------
   revision 1.2443
   date: 2008/03/20 15:50:57;  author: Simon;  state: Exp;  lines: +2 -3
   ...
   ----------------------------
   revision 1.2442
   date: 2008/03/20 06:52:53;  author: Eric;  state: Exp;  lines: +2 -3
   ...
15:50:57 is not between 06:52:53 and 09:24:13.
The corresponding "git log ChangeLog" shows the dates with timezone:
   commit 8b7bf418dde380e1d311ee68338a75182f2f4080
   Author: Eric Blake <ebb9@byu.net>
   Date:   Thu Mar 20 09:24:13 2008 -0600
   ...
   commit 216173c7d70cbd66f8791b6710cb8f8c3bf6eef9
   Author: Simon Josefsson <simon@josefsson.org>
   Date:   Thu Mar 20 15:50:57 2008 +0100
   ...
   commit 8a1a492ae9389b6b450b2f8a32550e0ddbe3957a
   Author: Eric Blake <ebb9@byu.net>
   Date:   Thu Mar 20 06:52:53 2008 -0600
This happens at git-cvsserver.perl line 1710:
            $revision->{modified} = sprintf('%04d/%02d/%02d %s', $3, $DATE_LIST->{$2}, $1, $4 ) if ( $revision->{modified} =~ /(\d+)\s+(\w+)\s+(\d+)\s+(\S+)/ and defined($DATE_LIST->{$2}) );
$revision->{modified}, originally "20 Mar 2008 09:24:13 -0600", is
transformed into "2008/03/20 09:24:13" by this line of code.
The date format used by the original "cvs" server program is:
  - cvs 1.12.9 and newer use the format "2008-03-20 15:24:13 +0000",
  - older cvs versions use the format   "2008/03/20 15:24:13"
I.e. in both cases it shows the date in GMT time zone.
Could git-cvsserver be changed to do the same thing? I.e. instead of
   ----------------------------
   revision 1.2444
   date: 2008/03/20 09:24:13;  author: Eric;  state: Exp;  lines: +2 -3
   ...
   ----------------------------
   revision 1.2443
   date: 2008/03/20 15:50:57;  author: Simon;  state: Exp;  lines: +2 -3
   ...
   ----------------------------
   revision 1.2442
   date: 2008/03/20 06:52:53;  author: Eric;  state: Exp;  lines: +2 -3
   ...
it should output
   ----------------------------
   revision 1.2444
   date: 2008/03/20 15:24:13;  author: Eric;  state: Exp;  lines: +2 -3
   ...
   ----------------------------
   revision 1.2443
   date: 2008/03/20 14:50:57;  author: Simon;  state: Exp;  lines: +2 -3
   ...
   ----------------------------
   revision 1.2442
   date: 2008/03/20 12:52:53;  author: Eric;  state: Exp;  lines: +2 -3
   ...

This would make the times grow continually, and be in line with what the "cvs" program does. As mentioned above, all that needs to be changed is line 1710 of git-cvsserver.perl.

Bruno
[1] http://cvs.savannah.nongnu.org/viewvc/ccvs/src/log.c?root=cvs&r1=1.95&r2=1.96

← back to recent threads