Hi Junio, On Fri, 10 Feb 2017, Junio C Hamano wrote: > Johannes Schindelin <johannes.schindelin@xxxxxx> writes: > > > diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh > > index 292a0720fcc..1d6e27a09d8 100755 > > --- a/t/t1700-split-index.sh > > +++ b/t/t1700-split-index.sh > > @@ -200,4 +200,21 @@ EOF > > test_cmp expect actual > > ' > > > > +test_expect_failure 'rev-parse --shared-index-path' ' > > + rm -rf .git && > > + test_create_repo . && > > + git update-index --split-index && > > + ls -t .git/sharedindex* | tail -n 1 >expect && > > + git rev-parse --shared-index-path >actual && > > + test_cmp expect actual && > > + mkdir work && > > + test_when_finished "rm -rf work" && > > + ( > > + cd work && > > + ls -t ../.git/sharedindex* | tail -n 1 >expect && > > + git rev-parse --shared-index-path >actual && > > + test_cmp expect actual > > + ) > > This looks iffy. Indeed. > If we expect multiple sharedindex* files, the first output from "ls -t" > may or may not match the real one in use (multiple things do happen > within a single second or whatever your filesystem's time granularity > is). Two "ls -t" run in this test would (hopefully) give stable > results, but I suspect that the chance the first line in the output > matches what --shared-index-path reports is 50% if we expect to have two > sharedindex* files. > > On the other hand, if we do not expect multiple sharedindex* files, > use of "ls" piped to "tail" is simply misleading. > > If this test can be written in such a way that there is only one > such file that match the pattern, it would be the cleanest to > understand and explain. As there is only a single invocation of > "update-index --split-index" immediately after a new repository is > created, I suspect that the expectation to see only one sharedindex* > file already holds (because its name is unpredictable, we still need > to catch it with wildcard), and if that is the case, we can just > lose "-t" and pipe to tail, i.e. "ls .git/sharedindex* >expect". Indeed. We can expect only one sharedindex file to be present, and we do not even have to call out to `ls` but can get away with calling `echo` (which is a builtin in Bash). Ciao, Johannes