@matheusbsbs / matheus-bagliano / commits / 180a4d76ac
Fork 0

t9100: stop depending on commit timestamps

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>

Jeff King committed Jul 15, 2020 at 03:42 UTC 180a4d76ac8f7c3e97be023e5943f719f3efb55b
1 file changed +3 -6
t/t9100-git-svn-basic.sh
+3 -6
@@ -8,10 +8,6 @@ GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
8
9 . ./lib-git-svn.sh
10
11 -# Make sure timestamps of commits created by Git interleave
12 -# with those created by "svn set-tree".
13 -unset GIT_COMMITTER_DATE
14 -
11 case "$GIT_SVN_LC_ALL" in
12 *.UTF-8)
13 test_set_prereq UTF8
@@ -204,8 +200,9 @@ GIT_SVN_ID=alt
200 export GIT_SVN_ID
201 test_expect_success "$name" \
202 'git svn init "$svnrepo" && git svn fetch &&
207 - git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
208 - git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
203 + git log --format="tree %T %s" remotes/git-svn |
204 + awk "!seen[\$0]++ { print \$1, \$2 }" >a &&
205 + git log --format="tree %T" alt >b &&
206 test_cmp a b'
207
208 name='check imported tree checksums expected tree checksums'