]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t9100: stop depending on commit timestamps
authorJeff King <peff@peff.net>
Wed, 15 Jul 2020 07:42:50 +0000 (03:42 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2020 15:02:58 +0000 (08:02 -0700)
An earlier "fix" to this script gave up updating it not to rely on
the current time because we cannot control what timestamp subversion
gives its commits.  We however could solve the issue in a different
way and still use deterministic timestamps on Git commits.

One fix would be to sort the list of trees before removing duplicates,
but that loses information:

  - we do care that the fetched history is in the same order

  - there's a tree which appears twice in the history, and we'd want to
    make sure that it's there both times

So instead, let's de-duplicate using a hash (preserving the order), and
drop only lines with identical trees and subjects (preserving the tree
which appears twice, since it has different subjects each time).

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9100-git-svn-basic.sh

index a89d338aa7de646a09b58f251387b1ba4d155a8e..8dd9645ce5b195e831f3b207579490ac78b8a840 100755 (executable)
@@ -8,10 +8,6 @@ GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
 
 . ./lib-git-svn.sh
 
-# Make sure timestamps of commits created by Git interleave
-# with those created by "svn set-tree".
-unset GIT_COMMITTER_DATE
-
 case "$GIT_SVN_LC_ALL" in
 *.UTF-8)
        test_set_prereq UTF8
@@ -204,8 +200,9 @@ GIT_SVN_ID=alt
 export GIT_SVN_ID
 test_expect_success "$name" \
     'git svn init "$svnrepo" && git svn fetch &&
-     git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
-     git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
+     git log --format="tree %T %s" remotes/git-svn |
+       awk "!seen[\$0]++ { print \$1, \$2 }" >a &&
+     git log --format="tree %T" alt >b &&
      test_cmp a b'
 
 name='check imported tree checksums expected tree checksums'