}
if (verbose) {
- struct strbuf subject;
+ struct strbuf subject = STRBUF_INIT;
const char *sub = " **** invalid ref ****";
char stat[128];
- strbuf_init(&subject, 0);
stat[0] = '\0';
commit = item->commit;
}
}
+static int calc_maxwidth(struct ref_list *refs)
+{
+ int i, l, w = 0;
+ for (i = 0; i < refs->index; i++) {
+ if (!matches_merge_filter(refs->list[i].commit))
+ continue;
+ l = strlen(refs->list[i].name);
+ if (l > w)
+ w = l;
+ }
+ return w;
+}
+
static void print_ref_list(int kinds, int detached, int verbose, int abbrev, struct commit_list *with_commit)
{
int i;
(struct object *) filter, "");
ref_list.revs.limited = 1;
prepare_revision_walk(&ref_list.revs);
+ if (verbose)
+ ref_list.maxwidth = calc_maxwidth(&ref_list);
}
qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);