On Tue, Nov 01, 2022 at 04:12:06PM -0400, Taylor Blau wrote: > Yeah, that looks reasonable to me. Presumably we want a small test, as > well, but I doubt that is any more complicated than: > > --- 8< --- > diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh > index 7f605f865b..6ace22f7ce 100755 > --- a/t/t3200-branch.sh > +++ b/t/t3200-branch.sh > @@ -279,6 +279,14 @@ 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 branch -D other" && > + git branch other && > + git checkout --orphan orphan && > + test_must_fail git branch -d other 2>err && > + grep "not fully merged" err > +' > + > test_expect_success 'git branch -v -d t should work' ' > git branch t && > git rev-parse --verify refs/heads/t && > --- >8 --- 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 +' + test_expect_success 'git branch -v -d t should work' ' git branch t && git rev-parse --verify refs/heads/t && --- 8< --- Thanks, Taylor