builtin-for-each-ref.c: check if we need to peel onion while parsing the format
Instead of iterating over the parsed atoms that are used in the output format after all the parsing is done, check it while parsing the format string.
Junio C Hamano committed
Feb 13, 2010 at 11:38 UTC
20322e0b552b9860377c162675ce5c49bfd32e83
1 file changed
+2
-7
builtin-for-each-ref.c
+2
-7
@@ -133,6 +133,8 @@ static int parse_atom(const char *atom, const char *ep)
133
(sizeof(*used_atom_type) * used_atom_cnt));
134
used_atom[at] = xmemdupz(atom, ep - atom);
135
used_atom_type[at] = valid_atom[i].cmp_type;
136
+ if (*atom == '*')
137
+ need_tagged = 1;
138
return at;
139
}
140
@@ -944,13 +946,6 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
946
refs = cbdata.grab_array;
947
num_refs = cbdata.grab_cnt;
948
947
- for (i = 0; i < used_atom_cnt; i++) {
948
- if (used_atom[i][0] == '*') {
949
- need_tagged = 1;
950
- break;
951
- }
952
- }
953
-
949
sort_refs(sort, refs, num_refs);
950
951
if (!maxcount || num_refs < maxcount)