Subject: Re: 'pu' broken at t5304 tonight

From: Brandon Williams <[email-masked]>
Date: Mon, 12 Jun 2017 11:03:57 -0700

On 06/11, Christian Couder wrote:
> On Sat, Jun 10, 2017 at 9:05 PM, Kevin Daudt <[email-masked]> wrote:
> > On Sat, Jun 10, 2017 at 02:48:36PM +0200, Kevin Daudt wrote:
> 
> >> For me, this bisects to the latest merge:
> >>
> >> 2047eebd3 (Merge branch 'bw/repo-object' into pu, 2017-06-10), but
> >> neither of the parent of the merge break this test, so it looks like
> >> it's because of an interaction between the repo-object topic and another
> >> topic.
> >
> > Merging the repo-object with different other topic branches reveals this
> > topic to cause the bad interaction:
> >
> > b56c91004 (Merge branch 'nd/prune-in-worktree' into pu, 2017-06-10)
> >
> > Still investigating why it happens.
> 
> Yeah, 9570b25a97 (revision.c: --indexed-objects add objects from all
> worktrees, 2017-04-19) adds the following test to t5304-prune.sh but
> this fails if nd/prune-in-worktree is rebased on top of
> bw/repo-object:
> 
> test_expect_success 'prune: handle index in multiple worktrees' '
>        git worktree add second-worktree &&
>        echo "new blob for second-worktree" >second-worktree/blob &&
>        git -C second-worktree add blob &&
>        git prune --expire=now &&
>        git -C second-worktree show :blob >actual &&
>        test_cmp second-worktree/blob actual
> '

I think I discovered what is going on here (and its mostly my fault :D).

(e7a6a3b15 revision.c: --indexed-objects add objects from all worktrees)
queries each worktree's index to add object which are pending in the
per-worktree index's.  To do this is uses 'worktree_git_path' in order
to construct a path to the worktree's index file.  My series introduced
a change to how 'adjust_git_path' functioned, instead of checking if the
index file came from the environment before replacing with the result of
'get_index_file()', i change it to unconditionally do this replacing
which breaks the ability to get a path to a worktree's index.

So this breakage is definitely my fault, but you would still run into
this exact same issue if you had set 'GIT_INDEX_FILE' as no worktree's
would be able to find their index files as they would be overridden by
the envvar.

-- 
Brandon Williams