t7814: do not generate same commits in different repos
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 28 Jun 2019 09:35:28 +0000 (16:35 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Jun 2019 16:32:23 +0000 (09:32 -0700)
commit663d25018f11418ed888128e8b07b1cbe576712a
tree2970085ad81eaf13a52a9dbf10a84e7325c1e9e2
parent34e7771bc64475d71430c20937f6828675ebccdb
t7814: do not generate same commits in different repos

t7814 has repo tree like this

  initial-repo
    submodule
      sub

In each repo 'submodule' and 'sub', a commit is made to add the same
initial file 'a' with the same message 'add a'. If tests run fast
enough, the two commits are made in the same second, resulting
identical commits.

There is nothing wrong with that per-se. But it could make the test
flaky. Currently all submodule odbs are merged back in the main
one (because we can't, or couldn't, access separate submodule repos
otherwise). But eventually we need to access objects from the right
repo.

Because the same commit could sometimes be present in both 'submodule'
and 'sub', if there is a bug looking up objects in the wrong repo,
sometimes it will go unnoticed because it finds the needed object in the
wrong repo anyway.

Fix this by changing commit time after every commit. This makes all
commits unique. Of course there are still identical blobs in different
repos, but because we often lookup commit first, then tree and blob,
unique commits are already quite safe.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7814-grep-recurse-submodules.sh