Re: [PATCH v3 2/2] worktree add: add --orphan flag
- From
Jacob Abel <jacobabel@nullpo.dev>
- Date
- Nov 19, 2022, 01:44 UTC
- Message-ID
- <20221119014436.737kqsmcezkck3do@phi>
- In-Reply-To
- <221115.86iljfkjjo.gmgdl@evledraar.gmail.com>
On 22/11/15 10:08PM, Ævar Arnfjörð Bjarmason wrote:
Show 14 quoted lines
> > > +test_expect_success '"add --orphan" fails if the branch already exists' ' > > + test_when_finished "git branch -D existingbranch" && > > + test_when_finished "git worktree remove -f -f orphandir" && > > + git worktree add -b existingbranch orphandir main && > > + test_must_fail git worktree add --orphan existingbranch orphandir2 && > > + test ! -d orphandir2 > > I'm not sure about "worktree" behavior, but maybe this "test ! -d" wants > to be a "test_path_is_missing"? > > In general we try to test what a thing is, not what it isn't, in this > case don't we fail to create the dir entirely? So "not exists" would > cover it?
Ah yes that would be preferable. I've updated it for v4.
This shows up in the file in a few other places in this file as well (from before this patch). Should I make the changes there as well and put those changes into an additional patch in this patchset?