Re: [PATCH v3 1/8] t2407: test branches currently using apply backend

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

 



"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Derrick Stolee <derrickstolee@xxxxxxxxxx>
>
> The tests in t2407 that verify the branch_checked_out() helper in the
> case of bisects and rebases were added by 9347303db89 (branch: check for
> bisects and rebases, 2022-06-08). However, that commit failed to check
> for rebases that are using the 'apply' backend.
>
> Add a test that checks the apply backend. The implementation was already
> correct here, but it is good to have regression tests before modifying
> the implementation further.
>
> Signed-off-by: Derrick Stolee <derrickstolee@xxxxxxxxxx>
> ---
>  t/t2407-worktree-heads.sh | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/t/t2407-worktree-heads.sh b/t/t2407-worktree-heads.sh
> index b6be42f74a2..4f59bc21303 100755
> --- a/t/t2407-worktree-heads.sh
> +++ b/t/t2407-worktree-heads.sh
> @@ -54,7 +54,18 @@ test_expect_success 'refuse to overwrite: worktree in bisect' '
>  	grep "cannot force update the branch '\''fake-2'\'' checked out at.*wt-4" err
>  '
>  
> -test_expect_success 'refuse to overwrite: worktree in rebase' '
> +test_expect_success 'refuse to overwrite: worktree in rebase (apply)' '
> +	test_when_finished rm -rf .git/worktrees/wt-*/rebase-apply &&
> +
> +	mkdir -p .git/worktrees/wt-3/rebase-apply &&
> +	echo refs/heads/fake-1 >.git/worktrees/wt-3/rebase-apply/head-name &&
> +	echo refs/heads/fake-2 >.git/worktrees/wt-3/rebase-apply/onto &&
> +
> +	test_must_fail git branch -f fake-1 HEAD 2>err &&
> +	grep "cannot force update the branch '\''fake-1'\'' checked out at.*wt-3" err
> +'
> +
> +test_expect_success 'refuse to overwrite: worktree in rebase (merge)' '
>  	test_when_finished rm -rf .git/worktrees/wt-*/rebase-merge &&
>  
>  	mkdir -p .git/worktrees/wt-3/rebase-merge &&

This is not the first offender, since the other existing one is
doing the same, but it is a bit sad that this makes it worse to
expose and depend on the details of the way the rebase happens to be
currently implemented.

Perhaps a more kosher way to do this is to find an commit that
surely would not allow fake-1 branch to be cleanly rebased onto and
actually start (and cause it to stop) a rebase.

I notice that the original offence was committed fairly recently, by
d2ba271a (branch: check for bisects and rebases, 2022-06-14) that we
can easily eject out of the 'next' branch when we rewind and rebuild
it, if we wanted to.

Anyway, let's read on.

Thanks.



[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]

  Powered by Linux