Re: [PATCH] setup: do not create $X/gitdir unnecessarily when accessing git file $X
On Mon, Nov 2, 2015 at 2:08 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 17 quoted lines
> $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 <pclouds@gmail.com>
> ---
> 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.
> +'