Re: [PATCH] worktree: allow the main brach of a bare repository to be checked out

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dennis Kaarsemaker <dennis@xxxxxxxxxxxxxxx> writes:

> OK, so here it is as a proper patch.
>
> D.
>
> diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
> index 4bcc335..2996c38 100755
> --- a/t/t2025-worktree-add.sh
> +++ b/t/t2025-worktree-add.sh
> @@ -138,6 +138,14 @@ test_expect_success 'checkout from a bare repo without "add"' '
>  	)
>  '
>  
> ++test_expect_success '"add" default branch of a bare repo' '

Huh?

> +	(
> +		git clone --bare . bare2 &&
> +		cd bare2 &&
> +		git worktree add ../there3 master
> +	)
> +'
> +
>  test_expect_success 'checkout with grafts' '
>  	test_when_finished rm .git/info/grafts &&
>  	test_commit abc &&
> diff --git a/worktree.c b/worktree.c
> index 5acfe4c..35e95b7 100644
> --- a/worktree.c
> +++ b/worktree.c
> @@ -345,6 +345,8 @@ const struct worktree *find_shared_symref(const char *symref,
>  
>  	for (i = 0; worktrees[i]; i++) {
>  		struct worktree *wt = worktrees[i];
> +		if(wt->is_bare)
> +			continue;
>  
>  		if (wt->is_detached && !strcmp(symref, "HEAD")) {
>  			if (is_worktree_being_rebased(wt, target)) {
> -- 
> 2.10.1-356-g947a599



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]