Subject: Re: [PATCH v2] read-cache: write all indexes with the same permissions

From: SZEDER Gábor <[email-masked]>
Date: Sat, 17 Nov 2018 13:24:17 +0100

On Fri, Nov 16, 2018 at 08:25:43PM +0100, Christian Couder wrote:
> On Fri, Nov 16, 2018 at 7:29 PM SZEDER Gábor <[email-masked]> wrote:
> >
> > On Fri, Nov 16, 2018 at 06:31:05PM +0100, Christian Couder wrote:
> > > diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
> > > index 2ac47aa0e4..fa1d3d468b 100755
> > > --- a/t/t1700-split-index.sh
> > > +++ b/t/t1700-split-index.sh
> > > @@ -381,6 +381,26 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"
> > >       test $(ls .git/sharedindex.* | wc -l) -le 2
> > >  '
> > >
> > > +test_expect_success POSIXPERM 'same mode for index & split index' '
> > > +     git init same-mode &&
> > > +     (
> > > +             cd same-mode &&
> > > +             test_commit A &&
> > > +             test_modebits .git/index >index_mode &&
> > > +             test_must_fail git config core.sharedRepository &&
> > > +             git -c core.splitIndex=true status &&
> > > +             shared=$(ls .git/sharedindex.*) &&
> >
> > I think the command substitution and 'ls' are unnecessary, and
> >
> >   shared=.git/sharedindex.*
> >
> > would work as well.
> 
> If there is no shared index file with the above we would get:
> 
> shared=.git/sharedindex.*
> $ echo $shared
> .git/sharedindex.*
> 
> which seems bug prone to me.

That's just a non-existing file, for which 'test_modebits' will print
nothing, which, in turn, will not match the modebits of '.git/index'.
And the "there are more than one shared index files" case is handled
by the case statement that was snipped from the email context.