Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 48c9162

Browse files
bdwaltongitster
authored andcommitted
cvsimport: format commit timestamp ourselves without using strftime
Some implementations of strftime(3) lack support for "%z". Also there is no need for %s in git-cvsimport as the supplied time is already in seconds since the epoch. For %z, use the function get_tz_offset provided by Git.pm instead. Signed-off-by: Ben Walton <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75f7b5d commit 48c9162

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git-cvsimport.perl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use IO::Pipe;
2727
use POSIX qw(strftime tzset dup2 ENOENT);
2828
use IPC::Open2;
29+
use Git qw(get_tz_offset);
2930

3031
$SIG{'PIPE'}="IGNORE";
3132
set_timezone('UTC');
@@ -864,7 +865,9 @@ sub commit {
864865
}
865866

866867
set_timezone($author_tz);
867-
my $commit_date = strftime("%s %z", localtime($date));
868+
# $date is in the seconds since epoch format
869+
my $tz_offset = get_tz_offset($date);
870+
my $commit_date = "$date $tz_offset";
868871
set_timezone('UTC');
869872
$ENV{GIT_AUTHOR_NAME} = $author_name;
870873
$ENV{GIT_AUTHOR_EMAIL} = $author_email;

0 commit comments

Comments
 (0)