git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Wong <e@80x24.org>,
	git@vger.kernel.org, Han-Wen Nienhuys <hanwen@google.com>
Subject: Re: [PATCH 0/4] deterministic commit timestamps in tests
Date: Tue, 14 Jul 2020 08:33:34 -0400	[thread overview]
Message-ID: <20200714123334.GB2587001@coredump.intra.peff.net> (raw)
In-Reply-To: <20200714123142.GA2587001@coredump.intra.peff.net>

On Tue, Jul 14, 2020 at 08:31:42AM -0400, Jeff King wrote:

> We _could_ fix this by sorting before removing duplicates, but
> presumably it's a useful part of the test to make sure the trees appear
> in the same order in both spots. Likewise, we could use something like:
> 
>   perl -ne 'print unless $seen{$_}++'
> 
> to remove duplicates without impacting the order. But that doesn't work
> either, because there are actually multiple (non-duplicate) commits with
> the same trees (we change a file mode and then change it back). So we'd
> actually have to de-duplicate the combination of subject and tree. Which
> then further throws off t9100.18, which compares the tree hashes
> exactly; we'd have to strip the result back down.

Actually, that last one isn't _too_ bad. It looks something like this:

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index b80952f0ac..4502c5f97d 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -204,8 +204,10 @@ 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 |
+	perl -lne "print unless \$seen{\$_}++" |
+	cut -d" " -f1-2 >a &&
+     git log --format="tree %T" remotes/alt >b &&
      test_cmp a b'
 
 name='check imported tree checksums expected tree checksums'

It does lose a little bit of information, which is that in the original
we confirmed that the duplicates were always next to each other. But I'm
not sure that's important. We'd get confused if the same subject
appeared twice, but all of the commits have distinct hard-coded
subjects in the earlier tests.

-Peff

  reply	other threads:[~2020-07-14 12:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 20:33 [PATCH 0/4] deterministic commit timestamps in tests Jeff King
2020-07-09 20:34 ` [PATCH 1/4] t6000: use test_tick consistently Jeff King
2020-07-09 20:35 ` [PATCH 2/4] t9700: loosen ident timezone regex Jeff King
2020-07-09 20:39 ` [PATCH 3/4] t5539: make timestamp requirements more explicit Jeff King
2020-07-09 20:42 ` [PATCH 4/4] test-lib: set deterministic default author/committer date Jeff King
2020-07-10 22:02 ` [PATCH 0/4] deterministic commit timestamps in tests Junio C Hamano
2020-07-14 12:31   ` Jeff King
2020-07-14 12:33     ` Jeff King [this message]
2020-07-14 21:47       ` Eric Wong
2020-07-15  7:42         ` Jeff King
2020-07-15 14:50           ` Junio C Hamano
2020-07-15 15:04             ` Junio C Hamano
2020-07-16 10:43               ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714123334.GB2587001@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hanwen@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).