From: Ben Walton <bdwalton@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Ben Walton <bdwalton@gmail.com>
Subject: [PATCH 3/3] Avoid non-portable strftime format specifiers in git-cvsimport
Date: Sat, 9 Feb 2013 21:46:58 +0000 [thread overview]
Message-ID: <1360446418-12280-4-git-send-email-bdwalton@gmail.com> (raw)
In-Reply-To: <1360446418-12280-1-git-send-email-bdwalton@gmail.com>
Neither %s or %z are portable strftime format specifiers. 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 <bdwalton@gmail.com>
---
git-cvsimport.perl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 0a31ebd..344f120 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -26,6 +26,7 @@ use IO::Socket;
use IO::Pipe;
use POSIX qw(strftime tzset dup2 ENOENT);
use IPC::Open2;
+use Git qw(get_tz_offset);
$SIG{'PIPE'}="IGNORE";
set_timezone('UTC');
@@ -864,7 +865,9 @@ sub commit {
}
set_timezone($author_tz);
- my $commit_date = strftime("%s %z", localtime($date));
+ # $date is in the seconds since epoch format
+ my $tz_offset = get_tz_offset($date);
+ my $commit_date = "$date $tz_offset";
set_timezone('UTC');
$ENV{GIT_AUTHOR_NAME} = $author_name;
$ENV{GIT_AUTHOR_EMAIL} = $author_email;
--
1.7.10.4
next prev parent reply other threads:[~2013-02-09 21:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-09 21:46 [PATCH 0/3] Fix a portability issue with git-cvsimport Ben Walton
2013-02-09 21:46 ` [PATCH 1/3] Move Git::SVN::get_tz to Git::get_tz_offset Ben Walton
2013-02-09 21:46 ` [PATCH 2/3] Fix get_tz_offset to properly handle DST boundary cases Ben Walton
2013-02-09 22:58 ` Junio C Hamano
2013-02-09 21:46 ` Ben Walton [this message]
2013-02-09 22:20 ` [PATCH 3/3] Avoid non-portable strftime format specifiers in git-cvsimport Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2013-01-15 23:10 [PATCH 0/3] Fix a portability issue with git-cvsimport Ben Walton
2013-01-15 23:10 ` [PATCH 3/3] Avoid non-portable strftime format specifiers in git-cvsimport Ben Walton
2013-01-16 1:53 ` Chris Rorvick
2013-01-16 10:38 ` Ben Walton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360446418-12280-4-git-send-email-bdwalton@gmail.com \
--to=bdwalton@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).