提交 b7da73ac 编写于 作者: J Junio C Hamano

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
......@@ -391,7 +391,6 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
struct ref_array array;
int maxwidth = 0;
const char *remote_prefix = "";
struct strbuf out = STRBUF_INIT;
char *to_free = NULL;
/*
......@@ -419,7 +418,10 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
ref_array_sort(sorting, &array);
for (i = 0; i < array.nr; i++) {
format_ref_array_item(array.items[i], format, &out);
struct strbuf out = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
if (format_ref_array_item(array.items[i], format, &out, &err))
die("%s", err.buf);
if (column_active(colopts)) {
assert(!filter->verbose && "--column and --verbose are incompatible");
/* 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
fwrite(out.buf, 1, out.len, stdout);
putchar('\n');
}
strbuf_release(&err);
strbuf_release(&out);
}
......
此差异已折叠。
......@@ -110,9 +110,10 @@ int verify_ref_format(struct ref_format *format);
/* Sort the given ref_array as per the ref_sorting provided */
void ref_array_sort(struct ref_sorting *sort, struct ref_array *array);
/* Based on the given format and quote_style, fill the strbuf */
void format_ref_array_item(struct ref_array_item *info,
const struct ref_format *format,
struct strbuf *final_buf);
int format_ref_array_item(struct ref_array_item *info,
const struct ref_format *format,
struct strbuf *final_buf,
struct strbuf *error_buf);
/* Print the ref using the given format and quote_style */
void show_ref_array_item(struct ref_array_item *info, const struct ref_format *format);
/* Parse a single sort specifier and add it to the list */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册