From: Eric Sunshine Date: Mon, 02 Nov 2015 20:01:47 GMT Subject: Re: [PATCH] setup: do not create $X/gitdir unnecessarily when accessing git file $X Message-ID: In-Reply-To: <1446491306-13493-1-git-send-email-pclouds@gmail.com> On Mon, Nov 2, 2015 at 2:08 PM, Nguyễn Thái Ngọc Duy wrote: > $X/gitdir is created, or refreshed, in order to keep a linked worktree > from being pruned. But while git file is used as the foundation for > linked worktrees, it's used for other purposes as well and we should > not create $X/gitdir in those cases. > > Tighten the check. Only update an existing file, which is an > indication this is a linked worktree. > > Signed-off-by: Nguyễn Thái Ngọc Duy > --- > diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh > @@ -99,6 +99,13 @@ test_expect_success 'check rev-list' ' > +test_expect_success '$REAL/gitdir is not created on ordinary git file' ' > + echo "gitdir: $REAL" >expected && > + test_cmp expected .git && > + git status && > + ! test -f "$REAL"/gitdir Minor: test_path_is_missing() might convey the intention a bit more clearly. > +'