aboutsummaryrefslogtreecommitdiff
path: root/ref-filter.h
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2025-01-18 18:11:34 +0100
committerJunio C Hamano <gitster@pobox.com>2025-01-21 09:06:15 -0800
commit5e58db65750a20ae6d0c620f8a2010e038d408f5 (patch)
tree87ddf40e8291d940eefc601e8b8960d874a888bf /ref-filter.h
parentfbe8d3079d4a96aeb4e4529cc93cc0043b759a05 (diff)
downloadgit-5e58db65750a20ae6d0c620f8a2010e038d408f5.tar.xz
ref-filter: move ahead-behind bases into used_atom
verify_ref_format() parses a ref-filter format string and stores recognized items in the static array "used_atom". For "ahead-behind:<committish>" it stores the committish part in a string_list member "bases" of struct ref_format. ref_sorting_options() also parses bare ref-filter format items and stores stores recognized ones in "used_atom" as well. The committish parts go to a dummy struct ref_format in parse_sorting_atom(), though, and are leaked and forgotten. If verify_ref_format() is called before ref_sorting_options(), like in git for-each-ref, then all works well if the sort key is included in the format string. If it isn't then sorting cannot work as the committishes are missing. If ref_sorting_options() is called first, like in git branch, then we have the additional issue that if the sort key is included in the format string then filter_ahead_behind() can't see its committish, will not generate any results for it and thus it will be expanded to an empty string. Fix those issues by replacing the string_list with a field in used_atom for storing the committish. This way it can be shared for handling both ref-filter format strings and sorting options in the same command. Reported-by: Ross Goldberg <ross.goldberg@gmail.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.h')
-rw-r--r--ref-filter.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/ref-filter.h b/ref-filter.h
index 754038ab07..5f3dd6c931 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -99,9 +99,6 @@ struct ref_format {
/* Internal state to ref-filter */
int need_color_reset_at_eol;
- /* List of bases for ahead-behind counts. */
- struct string_list bases;
-
/* List of bases for is-base indicators. */
struct string_list is_base_tips;
@@ -117,7 +114,6 @@ struct ref_format {
}
#define REF_FORMAT_INIT { \
.use_color = -1, \
- .bases = STRING_LIST_INIT_DUP, \
.is_base_tips = STRING_LIST_INIT_DUP, \
}
@@ -205,7 +201,6 @@ struct ref_array_item *ref_array_push(struct ref_array *array,
* If this is not called, then any ahead-behind atoms will be blank.
*/
void filter_ahead_behind(struct repository *r,
- struct ref_format *format,
struct ref_array *array);
/*