[PATCH v28 0/2] status: add status.compareBranches config for multiple branch comparisons
From: Harald Nordgren via GitGitGadget <hidden>
Date: 2026-01-22 20:07:57
cc: Chris Torek chris.torek@gmail.com cc: Yee Cheng Chin
ychin.macvim@gmail.com cc: "brian m. carlson" sandals@crustytoothpaste.net
cc: Ben Knoble ben.knoble@gmail.com cc: "Kristoffer Haugsbakk"
kristofferhaugsbakk@fastmail.com cc: Phillip Wood phillip.wood123@gmail.com
cc: Nico Williams nico@cryptonector.com cc: Patrick Steinhardt ps@pks.im cc:
Jeff King peff@peff.net
Harald Nordgren (2):
refactor format_branch_comparison in preparation
status: add status.compareBranches config for multiple branch
comparisons
Documentation/config/status.adoc | 20 ++
remote.c | 191 ++++++++++++++----
t/t6040-tracking-info.sh | 337 +++++++++++++++++++++++++++++++
3 files changed, 511 insertions(+), 37 deletions(-)
base-commit: 83a69f19359e6d9bc980563caca38b2b5729808c
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2138%2FHaraldNordgren%2Fahead_of_main_status-v28
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2138/HaraldNordgren/ahead_of_main_status-v28
Pull-Request: https://github.com/git/git/pull/2138
Range-diff vs v27:
1: 27a46f8d9c = 1: f3c8c782b0 refactor format_branch_comparison in preparation
2: 0993420fc1 ! 2: 067978dd09 status: add status.compareBranches config for multiple branch comparisons
@@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,
- int upstream_is_gone = 0;
+ char *compare_branches = NULL;
+ struct string_list branches = STRING_LIST_INIT_DUP;
-+ struct string_list processed_refs = STRING_LIST_INIT_DUP;
++ struct strset processed_refs = STRSET_INIT;
+ int reported = 0;
+ size_t i;
+ const char *upstream_ref;
@@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,
+ if (!full_ref)
+ continue;
+
-+ if (string_list_has_string(&processed_refs, full_ref)) {
++ if (!strset_add(&processed_refs, full_ref)) {
+ free(full_ref);
+ continue;
+ }
-+ string_list_insert(&processed_refs, full_ref);
+
+ short_ref = refs_shorten_unambiguous_ref(
+ get_main_ref_store(the_repository), full_ref, 0);
@@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,
- free(base);
- return 1;
+ string_list_clear(&branches, 0);
-+ string_list_clear(&processed_refs, 0);
++ strset_clear(&processed_refs);
+ free(compare_branches);
+ return reported;
}
--
gitgitgadget