Commit 5e58db6
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>1 parent fbe8d30 commit 5e58db6
File tree
4 files changed
+59
-26
lines changed- builtin
- t
4 files changed
+59
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
| 476 | + | |
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
| |||
891 | 894 | | |
892 | 895 | | |
893 | 896 | | |
894 | | - | |
895 | | - | |
| 897 | + | |
| 898 | + | |
896 | 899 | | |
897 | 900 | | |
898 | | - | |
899 | | - | |
900 | 901 | | |
901 | 902 | | |
902 | 903 | | |
903 | | - | |
904 | | - | |
905 | | - | |
| 904 | + | |
| 905 | + | |
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
| |||
3084 | 3084 | | |
3085 | 3085 | | |
3086 | 3086 | | |
3087 | | - | |
3088 | 3087 | | |
3089 | 3088 | | |
3090 | 3089 | | |
3091 | | - | |
| 3090 | + | |
3092 | 3091 | | |
3093 | | - | |
| 3092 | + | |
3094 | 3093 | | |
3095 | 3094 | | |
3096 | | - | |
3097 | | - | |
3098 | | - | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
3099 | 3101 | | |
3100 | | - | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
3101 | 3107 | | |
3102 | | - | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
3103 | 3111 | | |
3104 | 3112 | | |
3105 | 3113 | | |
| |||
3108 | 3116 | | |
3109 | 3117 | | |
3110 | 3118 | | |
3111 | | - | |
3112 | | - | |
| 3119 | + | |
| 3120 | + | |
3113 | 3121 | | |
3114 | 3122 | | |
3115 | 3123 | | |
| |||
3277 | 3285 | | |
3278 | 3286 | | |
3279 | 3287 | | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
3280 | 3292 | | |
3281 | 3293 | | |
3282 | | - | |
3283 | 3294 | | |
3284 | 3295 | | |
3285 | 3296 | | |
| |||
3303 | 3314 | | |
3304 | 3315 | | |
3305 | 3316 | | |
3306 | | - | |
| 3317 | + | |
3307 | 3318 | | |
3308 | 3319 | | |
3309 | 3320 | | |
| |||
3647 | 3658 | | |
3648 | 3659 | | |
3649 | 3660 | | |
3650 | | - | |
3651 | 3661 | | |
3652 | 3662 | | |
3653 | 3663 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 102 | | |
106 | 103 | | |
107 | 104 | | |
| |||
117 | 114 | | |
118 | 115 | | |
119 | 116 | | |
120 | | - | |
121 | 117 | | |
122 | 118 | | |
123 | 119 | | |
| |||
205 | 201 | | |
206 | 202 | | |
207 | 203 | | |
208 | | - | |
209 | 204 | | |
210 | 205 | | |
211 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
371 | 399 | | |
372 | 400 | | |
373 | 401 | | |
| |||
0 commit comments