On Tue, Nov 01, 2022 at 04:14:40PM -0400, Taylor Blau wrote: > Actually, the test doesn't need "other" here, since we aren't actually > going to delete the target branch (for the exact same reason that you > pointed out to Martin earlier in the thread). > > So it could actually be as small as something like this: > > --- >8 --- > diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh > index 7f605f865b..464d3f610b 100755 > --- a/t/t3200-branch.sh > +++ b/t/t3200-branch.sh > @@ -279,6 +279,13 @@ test_expect_success 'git branch -M and -C fail on detached HEAD' ' > test_cmp expect err > ' > > +test_expect_success 'git branch -d on detached HEAD' ' > + test_when_finished git checkout main && > + git checkout --orphan orphan && > + test_must_fail git branch -d main 2>err && > + grep "not fully merged" err > +' I think there's a more interesting case, which is when "main" has a configured upstream to which it's fully merged. And then the deletion actually succeeds (and the bug is not just giving us a crappy message, but actually doing causing the wrong outcome). And for that we'd probably not want to use "main", since a successful test will actually delete it. ;) I'll try later tonight to integrate that test into the patch you've written. -Peff