Re: [PATCH v5 4/4] worktree add: Add hint to use --orphan when bad ref
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 20, 2022, 06:18 UTC
- Message-ID
- <xmqqfsdawqbw.fsf@gitster.g>
- In-Reply-To
- <20221220023637.29042-5-jacobabel@nullpo.dev>
Jacob Abel <jacobabel@nullpo.dev> writes:
> Subject: Re: [PATCH v5 4/4] worktree add: Add hint to use --orphan when bad ref
Incomplete sentence that invites "when bad ref, what?"
> + " git worktree add --orphan %s %s\n"), new_branch, path
OK. "git worktree add -b <name-of-branch> <path>" is how you create a worktree and have it on a named branch. And instead of saying -b, you would say --orphan. This sounds like a fairly easy-to-understand parallel to how "git checkout [-b/-B/--orphan] name-of-branch" takes its parameters.
Show 8 quoted lines
> +test_wt_add_empty_repo_orphan_hint() {
> + local context="$1"
> + shift
> + local opts="$@"
> + test_expect_success "'worktree add' show orphan hint in empty repo w/ $context" '
> + test_when_finished "rm -rf empty_repo" &&
> + GIT_DIR="empty_repo" git init --bare &&
> + test_must_fail git -C empty_repo worktree add $opts foobar/ 2> actual &&The comments on "$@" (vs "$*") in an earlier step equally applies here.