Skip to content

Commit

Permalink
builtin-for-each-ref.c: check if we need to peel onion while parsing …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
Junio C Hamano committed Feb 13, 2010
1 parent 40dae30 commit 20322e0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions builtin-for-each-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ static int parse_atom(const char *atom, const char *ep)
(sizeof(*used_atom_type) * used_atom_cnt));
used_atom[at] = xmemdupz(atom, ep - atom);
used_atom_type[at] = valid_atom[i].cmp_type;
if (*atom == '*')
need_tagged = 1;
return at;
}

Expand Down Expand Up @@ -944,13 +946,6 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
refs = cbdata.grab_array;
num_refs = cbdata.grab_cnt;

for (i = 0; i < used_atom_cnt; i++) {
if (used_atom[i][0] == '*') {
need_tagged = 1;
break;
}
}

sort_refs(sort, refs, num_refs);

if (!maxcount || num_refs < maxcount)
Expand Down

0 comments on commit 20322e0

Please sign in to comment.