Re: [PATCH v5 4/4] worktree add: Add hint to use --orphan when bad ref

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

 



On 22/12/20 03:18PM, Junio C Hamano wrote:
> Jacob Abel <jacobabel@xxxxxxxxxx> 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?"

Noted. Changed commit title to the following:

    worktree add: add hint to direct users towards --orphan

>
> > +			"	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.

Yes. Originally it was a direct reproduction of `git checkout --orphan` with the
syntax being `git worktree add --orphan new_branch path/ old_branch` and the
operation checking out `old_branch` then discarding the commit history to make
the orphan branch `new_branch`. However after some discussion[1], the option was
changed to match `git switch --orphan` with the syntax and behavior we have now.

>
> > +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.

Noted. Changed.

1. https://lore.kernel.org/git/CAPig+cSVzewXpk+eDSC-W-+Q8X_7ikZXXeSQbmpHBcdLCU5svw@xxxxxxxxxxxxxx/





[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