From: Eric Wong <normalperson@yhbt.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "David D. Kilzer" <ddkilzer@kilzer.net>
Subject: [PATCH 2/3] Fix race condition in t9119-git-svn-info.sh
Date: Tue, 5 Aug 2008 00:35:17 -0700 [thread overview]
Message-ID: <1217921718-25011-2-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: <1217921718-25011-1-git-send-email-normalperson@yhbt.net>
From: David D. Kilzer <ddkilzer@kilzer.net>
Changed the ptouch bash function to use the "Text Last Updated"
date reported by 'svn info' when changing the modified time
(mtime) of the file/symlink/directory in the git working
directory. Previously it used the mtime of the item in the
svn working directory, which caused the race condition.
[ew: swapped argument order of ptouch() to minimize diff]
From: David D. Kilzer <ddkilzer@kilzer.net>
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
---
t/t9119-git-svn-info.sh | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index cc61911..964011e 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -11,11 +11,18 @@ test_done
ptouch() {
perl -w -e '
use strict;
+ use POSIX qw(mktime);
die "ptouch requires exactly 2 arguments" if @ARGV != 2;
- die "$ARGV[0] does not exist" if ! -e $ARGV[0];
- my @s = stat $ARGV[0];
- utime $s[8], $s[9], $ARGV[1];
- ' "$1" "$2"
+ my $text_last_updated = shift @ARGV;
+ my $git_file = shift @ARGV;
+ die "\"$git_file\" does not exist" if ! -e $git_file;
+ if ($text_last_updated
+ =~ /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/) {
+ my $mtime = mktime($6, $5, $4, $3, $2 - 1, $1 - 1900);
+ my $atime = $mtime;
+ utime $atime, $mtime, $git_file;
+ }
+ ' "`svn info $2 | grep '^Text Last Updated:'`" "$1"
}
test_expect_success 'setup repository and import' "
--
1.6.0.rc1.69.g797ea
next prev parent reply other threads:[~2008-08-05 7:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-05 7:35 [PATCH 1/3] git-svn: properly set path for "info" command Eric Wong
2008-08-05 7:35 ` Eric Wong [this message]
2008-08-05 7:35 ` [PATCH 3/3] t9119: conditionally re-enable test depending on svn(1) version Eric Wong
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=1217921718-25011-2-git-send-email-normalperson@yhbt.net \
--to=normalperson@yhbt.net \
--cc=ddkilzer@kilzer.net \
--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