aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid D. Kilzer <ddkilzer@kilzer.net>2008-08-05 00:35:17 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-05 21:21:19 -0700
commitd9042a0ac41ebd23e4dac00371a682d964eafee7 (patch)
treedd0b29a0a78c8a886b96c428a55dd8caf59629e2 /t
parentbd2d4f96b34ae295413f35eab687d7eff26564ee (diff)
downloadgit-d9042a0ac41ebd23e4dac00371a682d964eafee7.tar.gz
git-d9042a0ac41ebd23e4dac00371a682d964eafee7.tar.xz
Fix race condition in t9119-git-svn-info.sh
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t9119-git-svn-info.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index cc6191159..964011eba 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' "