Re: [PATCH v18 1/7] branch: add --forked filter for --list mode
From: Harald Nordgren <hidden>
Date: 2026-07-11 12:31:36
The implementation looks good, I've left a couple of small comments on the tests.
Thanks for all the help so far! Much appreciated!
One thought I had was whether we want a mode which recurses so that if the upstream of topic2 is topic1 which has an upstream of origin/main --forked=recurse origin/main would list topic1 and topic2. So long as we don't think that is a sensible default we can add it in the future if we want.
I don't understand this one, but if we safely do it later then that sounds good considering we will soon be on v19.
quoted
+ git branch local-base && + git branch --track local-one origin/one && + git branch --track local-two origin/two && + git branch --track local-foreign other/foreign && + git branch --track local-onbase local-base && + + git checkout local-one && + test_commit --no-tag local-one-work local-one.t && + git checkout local-foreign && + test_commit --no-tag local-foreign-work local-foreign.t && + git checkout --detachWhy do we need a detached HEAD?
The '--delete-merged honours branch.<name>.deleteMerged=false' ' and "branch -d still deletes a deleteMerged=false branch" ' tests need it, but it's not necessary here, deleting.
quoted
+ git -C forked branch --forked "origin/*" --no-merged origin/one \ + --format="%(refname:short)" >actual && + echo local-one >expect && + test_cmp expect actual +' + +test_expect_success '--forked rejects unknown branch/pattern' ' + test_must_fail git -C forked branch --forked nope 2>err && + test_grep "not a valid branch or pattern" err +' + +test_expect_success '--forked requires a value' ' + test_must_fail git -C forked branch --forked 2>err && + test_grep "requires a value" err +'It is a bit odd to have these two tests in the middle of the ones that check the functionality works.
Good point, reordering. Harald