summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2011-07-31 13:45:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-01 17:24:20 (GMT)
commit4e2e6ce45047fe2713546127f3d1ded576e1bf7e (patch)
tree75d2b396c3496cb9372309d05ead0f318b157580 /t
parenteab30818a9d0b874f9b339374349043f2c4aee5d (diff)
downloadgit-4e2e6ce45047fe2713546127f3d1ded576e1bf7e.zip
git-4e2e6ce45047fe2713546127f3d1ded576e1bf7e.tar.gz
git-4e2e6ce45047fe2713546127f3d1ded576e1bf7e.tar.bz2
git-p4: commit time should be most recent p4 change time
When importing a repo, the time on the initial commit had been just "now". But this causes problems when trying to share among git-p4 repos that were created identically, although at different times. Instead, use the time in the top-most p4 change as the time for the git import commit. Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t9800-git-p4.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t9800-git-p4.sh b/t/t9800-git-p4.sh
index b304707..97ec975 100755
--- a/t/t9800-git-p4.sh
+++ b/t/t9800-git-p4.sh
@@ -249,6 +249,25 @@ test_expect_success 'not preserving user with mixed authorship' '
p4_check_commit_author usernamefile3 alice
'
+marshal_dump() {
+ what=$1
+ python -c 'import marshal, sys; d = marshal.load(sys.stdin); print d["'$what'"]'
+}
+
+# Sleep a bit so that the top-most p4 change did not happen "now". Then
+# import the repo and make sure that the initial import has the same time
+# as the top-most change.
+test_expect_success 'initial import time from top change time' '
+ p4change=$(p4 -G changes -m 1 //depot/... | marshal_dump change) &&
+ p4time=$(p4 -G changes -m 1 //depot/... | marshal_dump time) &&
+ sleep 3 &&
+ "$GITP4" clone --dest="$git" //depot &&
+ test_when_finished cleanup_git &&
+ cd "$git" &&
+ gittime=$(git show -s --raw --pretty=format:%at HEAD) &&
+ echo $p4time $gittime &&
+ test $p4time = $gittime
+'
test_expect_success 'shutdown' '
pid=`pgrep -f p4d` &&