Skip to content

Commit b7da73a

Browse files
committed
Merge branch 'ot/libify-get-ref-atom-value'
Code restructuring, in preparation for further work. * ot/libify-get-ref-atom-value: ref-filter: libify get_ref_atom_value() ref-filter: add return value to parsers ref-filter: change parsing function error handling ref-filter: add return value && strbuf to handlers ref-filter: start adding strbufs with errors ref-filter: add shortcut to work with strbufs
2 parents 0c7ecb7 + e339611 commit b7da73a

File tree

3 files changed

+206
-101
lines changed

3 files changed

+206
-101
lines changed

builtin/branch.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
391391
struct ref_array array;
392392
int maxwidth = 0;
393393
const char *remote_prefix = "";
394-
struct strbuf out = STRBUF_INIT;
395394
char *to_free = NULL;
396395

397396
/*
@@ -419,7 +418,10 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
419418
ref_array_sort(sorting, &array);
420419

421420
for (i = 0; i < array.nr; i++) {
422-
format_ref_array_item(array.items[i], format, &out);
421+
struct strbuf out = STRBUF_INIT;
422+
struct strbuf err = STRBUF_INIT;
423+
if (format_ref_array_item(array.items[i], format, &out, &err))
424+
die("%s", err.buf);
423425
if (column_active(colopts)) {
424426
assert(!filter->verbose && "--column and --verbose are incompatible");
425427
/* format to a string_list to let print_columns() do its job */
@@ -428,6 +430,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
428430
fwrite(out.buf, 1, out.len, stdout);
429431
putchar('\n');
430432
}
433+
strbuf_release(&err);
431434
strbuf_release(&out);
432435
}
433436

0 commit comments

Comments
 (0)