]> git.ipfire.org Git - thirdparty/git.git/commit
branch: prepare delete_branches for a bulk caller
authorHarald Nordgren <haraldnordgren@gmail.com>
Wed, 3 Jun 2026 09:04:36 +0000 (09:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Jun 2026 10:10:05 +0000 (19:10 +0900)
commit4d70f2d269fe6f0e7aa580fa8746f5fb9fa857d1
tree085b9616307a470e8712389d4a9ecfe3ab177b29
parent0ce3d598de4b08d8af30b41f07eded459d6c164b
branch: prepare delete_branches for a bulk caller

Add no_head_fallback and dry_run flags to delete_branches() so a
bulk caller (the upcoming --prune-merged) can ask strictly about
merged-into-upstream without a silent fallback to HEAD, and
rehearse deletions with the same "Would delete branch ..." wording
as the live run. Existing callers pass 0 for both and keep current
behavior.

When no_head_fallback is set, head_rev stays NULL through to
branch_merged(), whose "merged to X but not yet merged to HEAD"
reminder otherwise compares against HEAD. For the bulk caller
every candidate is known to have an upstream, so HEAD is
irrelevant. Guard the block on head_rev so the NULL case skips
it instead of treating "NULL != reference_rev" as "diverges from
HEAD" and emitting a spurious warning.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c