]> git.ipfire.org Git - thirdparty/git.git/blame - builtin/name-rev.c
Merge branch 'jc/auto-gc-quiet'
[thirdparty/git.git] / builtin / name-rev.c
CommitLineData
d6b64ed0 1#include "builtin.h"
bd321bcc 2#include "cache.h"
109cd76d 3#include "repository.h"
b2141fc1 4#include "config.h"
bd321bcc
JS
5#include "commit.h"
6#include "tag.h"
7#include "refs.h"
edefb1a2 8#include "parse-options.h"
49f7a2fd 9#include "prio-queue.h"
b23e0b93 10#include "sha1-lookup.h"
8fd79a73 11#include "commit-slab.h"
bd321bcc 12
2e09c012
SG
13/*
14 * One day. See the 'name a rev shortly after epoch' test in t6120 when
15 * changing this value
16 */
17#define CUTOFF_DATE_SLOP 86400
c075aea5 18
71620ca8 19struct rev_name {
2d539754 20 char *tip_name;
dddbad72 21 timestamp_t taggerdate;
bd321bcc 22 int generation;
ac076c29 23 int distance;
ef1e7406 24 int from_tag;
71620ca8 25};
bd321bcc 26
f13ca7ce 27define_commit_slab(commit_rev_name, struct rev_name);
8fd79a73 28
5589e87f 29static timestamp_t cutoff = TIME_MAX;
8fd79a73 30static struct commit_rev_name rev_names;
bd321bcc 31
ac076c29
JS
32/* How many generations are maximally preferred over _one_ merge traversal? */
33#define MERGE_TRAVERSAL_WEIGHT 65535
34
f13ca7ce
RS
35static int is_valid_rev_name(const struct rev_name *name)
36{
2d539754 37 return name && (name->generation || name->tip_name);
f13ca7ce
RS
38}
39
36d2419c 40static struct rev_name *get_commit_rev_name(const struct commit *commit)
8fd79a73 41{
f13ca7ce 42 struct rev_name *name = commit_rev_name_peek(&rev_names, commit);
8fd79a73 43
f13ca7ce 44 return is_valid_rev_name(name) ? name : NULL;
8fd79a73
NTND
45}
46
0041bf65 47static int is_better_name(struct rev_name *name,
78089b71 48 timestamp_t taggerdate,
ef1e7406
JH
49 int distance,
50 int from_tag)
0041bf65 51{
ef1e7406
JH
52 /*
53 * When comparing names based on tags, prefer names
54 * based on the older tag, even if it is farther away.
55 */
56 if (from_tag && name->from_tag)
57 return (name->taggerdate > taggerdate ||
58 (name->taggerdate == taggerdate &&
59 name->distance > distance));
60
61 /*
62 * We know that at least one of them is a non-tag at this point.
63 * favor a tag over a non-tag.
64 */
65 if (name->from_tag != from_tag)
66 return from_tag;
67
68 /*
69 * We are now looking at two non-tags. Tiebreak to favor
70 * shorter hops.
71 */
72 if (name->distance != distance)
73 return name->distance > distance;
74
75 /* ... or tiebreak to favor older date */
76 if (name->taggerdate != taggerdate)
77 return name->taggerdate > taggerdate;
78
79 /* keep the current one if we cannot decide */
80 return 0;
0041bf65
JH
81}
82
766f9e39 83static struct rev_name *create_or_update_name(struct commit *commit,
766f9e39
SG
84 timestamp_t taggerdate,
85 int generation, int distance,
86 int from_tag)
bd321bcc 87{
f13ca7ce 88 struct rev_name *name = commit_rev_name_at(&rev_names, commit);
bd321bcc 89
2d539754
RS
90 if (is_valid_rev_name(name)) {
91 if (!is_better_name(name, taggerdate, distance, from_tag))
92 return NULL;
93
94 /*
95 * This string might still be shared with ancestors
96 * (generation > 0). We can release it here regardless,
97 * because the new name that has just won will be better
98 * for them as well, so name_rev() will replace these
99 * stale pointers when it processes the parents.
100 */
101 if (!name->generation)
102 free(name->tip_name);
103 }
3e2feb0d 104
3e2feb0d
105 name->taggerdate = taggerdate;
106 name->generation = generation;
107 name->distance = distance;
108 name->from_tag = from_tag;
109
110 return name;
766f9e39
SG
111}
112
ddc42ec7
RS
113static char *get_parent_name(const struct rev_name *name, int parent_number)
114{
1c56fc20 115 struct strbuf sb = STRBUF_INIT;
ddc42ec7
RS
116 size_t len;
117
118 strip_suffix(name->tip_name, "^0", &len);
1c56fc20
RS
119 if (name->generation > 0) {
120 strbuf_grow(&sb, len +
121 1 + decimal_width(name->generation) +
122 1 + decimal_width(parent_number));
123 strbuf_addf(&sb, "%.*s~%d^%d", (int)len, name->tip_name,
124 name->generation, parent_number);
125 } else {
126 strbuf_grow(&sb, len +
127 1 + decimal_width(parent_number));
128 strbuf_addf(&sb, "%.*s^%d", (int)len, name->tip_name,
129 parent_number);
130 }
131 return strbuf_detach(&sb, NULL);
ddc42ec7
RS
132}
133
49f7a2fd 134static void name_rev(struct commit *start_commit,
dddbad72 135 const char *tip_name, timestamp_t taggerdate,
2866fd28 136 int from_tag, int deref)
bd321bcc 137{
49f7a2fd
SG
138 struct prio_queue queue;
139 struct commit *commit;
140 struct commit **parents_to_queue = NULL;
141 size_t parents_to_queue_nr, parents_to_queue_alloc = 0;
977dc191 142 struct rev_name *start_name;
2866fd28
SG
143
144 parse_commit(start_commit);
145 if (start_commit->date < cutoff)
146 return;
147
977dc191
RS
148 start_name = create_or_update_name(start_commit, taggerdate, 0, 0,
149 from_tag);
150 if (!start_name)
151 return;
2866fd28 152 if (deref)
977dc191 153 start_name->tip_name = xstrfmt("%s^0", tip_name);
15a4205d 154 else
977dc191 155 start_name->tip_name = xstrdup(tip_name);
bd321bcc 156
49f7a2fd
SG
157 memset(&queue, 0, sizeof(queue)); /* Use the prio_queue as LIFO */
158 prio_queue_put(&queue, start_commit);
159
160 while ((commit = prio_queue_get(&queue))) {
161 struct rev_name *name = get_commit_rev_name(commit);
162 struct commit_list *parents;
163 int parent_number = 1;
164
165 parents_to_queue_nr = 0;
166
167 for (parents = commit->parents;
168 parents;
169 parents = parents->next, parent_number++) {
170 struct commit *parent = parents->item;
977dc191 171 struct rev_name *parent_name;
49f7a2fd
SG
172 int generation, distance;
173
174 parse_commit(parent);
175 if (parent->date < cutoff)
176 continue;
177
178 if (parent_number > 1) {
49f7a2fd
SG
179 generation = 0;
180 distance = name->distance + MERGE_TRAVERSAL_WEIGHT;
181 } else {
49f7a2fd
SG
182 generation = name->generation + 1;
183 distance = name->distance + 1;
184 }
185
977dc191
RS
186 parent_name = create_or_update_name(parent, taggerdate,
187 generation,
188 distance, from_tag);
189 if (parent_name) {
190 if (parent_number > 1)
191 parent_name->tip_name =
192 get_parent_name(name,
193 parent_number);
194 else
195 parent_name->tip_name = name->tip_name;
49f7a2fd
SG
196 ALLOC_GROW(parents_to_queue,
197 parents_to_queue_nr + 1,
198 parents_to_queue_alloc);
199 parents_to_queue[parents_to_queue_nr] = parent;
200 parents_to_queue_nr++;
201 }
bd321bcc 202 }
3a521503 203
49f7a2fd
SG
204 /* The first parent must come out first from the prio_queue */
205 while (parents_to_queue_nr)
206 prio_queue_put(&queue,
207 parents_to_queue[--parents_to_queue_nr]);
bd321bcc 208 }
49f7a2fd
SG
209
210 clear_prio_queue(&queue);
211 free(parents_to_queue);
bd321bcc
JS
212}
213
98c5c4ad
NK
214static int subpath_matches(const char *path, const char *filter)
215{
216 const char *subpath = path;
217
218 while (subpath) {
55d34269 219 if (!wildmatch(filter, subpath, 0))
98c5c4ad
NK
220 return subpath - path;
221 subpath = strchr(subpath, '/');
222 if (subpath)
223 subpath++;
224 }
225 return -1;
226}
227
9608a190
JH
228static const char *name_ref_abbrev(const char *refname, int shorten_unambiguous)
229{
230 if (shorten_unambiguous)
231 refname = shorten_unambiguous_ref(refname, 0);
2059e79c
RS
232 else if (skip_prefix(refname, "refs/heads/", &refname))
233 ; /* refname already advanced */
234 else
235 skip_prefix(refname, "refs/", &refname);
9608a190
JH
236 return refname;
237}
238
2afc29aa
JS
239struct name_ref_data {
240 int tags_only;
23615708 241 int name_only;
290be667 242 struct string_list ref_filters;
96415b49 243 struct string_list exclude_filters;
2afc29aa
JS
244};
245
b23e0b93
JH
246static struct tip_table {
247 struct tip_table_entry {
511dca80 248 struct object_id oid;
b23e0b93 249 const char *refname;
079f9709
RS
250 struct commit *commit;
251 timestamp_t taggerdate;
252 unsigned int from_tag:1;
253 unsigned int deref:1;
b23e0b93
JH
254 } *table;
255 int nr;
256 int alloc;
257 int sorted;
258} tip_table;
259
511dca80 260static void add_to_tip_table(const struct object_id *oid, const char *refname,
079f9709
RS
261 int shorten_unambiguous, struct commit *commit,
262 timestamp_t taggerdate, int from_tag, int deref)
b23e0b93
JH
263{
264 refname = name_ref_abbrev(refname, shorten_unambiguous);
265
266 ALLOC_GROW(tip_table.table, tip_table.nr + 1, tip_table.alloc);
511dca80 267 oidcpy(&tip_table.table[tip_table.nr].oid, oid);
b23e0b93 268 tip_table.table[tip_table.nr].refname = xstrdup(refname);
079f9709
RS
269 tip_table.table[tip_table.nr].commit = commit;
270 tip_table.table[tip_table.nr].taggerdate = taggerdate;
271 tip_table.table[tip_table.nr].from_tag = from_tag;
272 tip_table.table[tip_table.nr].deref = deref;
b23e0b93
JH
273 tip_table.nr++;
274 tip_table.sorted = 0;
275}
276
277static int tipcmp(const void *a_, const void *b_)
278{
279 const struct tip_table_entry *a = a_, *b = b_;
511dca80 280 return oidcmp(&a->oid, &b->oid);
b23e0b93
JH
281}
282
079f9709
RS
283static int cmp_by_tag_and_age(const void *a_, const void *b_)
284{
285 const struct tip_table_entry *a = a_, *b = b_;
286 int cmp;
287
288 /* Prefer tags. */
289 cmp = b->from_tag - a->from_tag;
290 if (cmp)
291 return cmp;
292
293 /* Older is better. */
294 if (a->taggerdate < b->taggerdate)
295 return -1;
296 return a->taggerdate != b->taggerdate;
297}
298
73868486 299static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data)
bd321bcc 300{
109cd76d 301 struct object *o = parse_object(the_repository, oid);
2afc29aa 302 struct name_ref_data *data = cb_data;
98c5c4ad 303 int can_abbreviate_output = data->tags_only && data->name_only;
bd321bcc 304 int deref = 0;
079f9709
RS
305 int from_tag = 0;
306 struct commit *commit = NULL;
dddbad72 307 timestamp_t taggerdate = TIME_MAX;
bd321bcc 308
59556548 309 if (data->tags_only && !starts_with(path, "refs/tags/"))
2afc29aa
JS
310 return 0;
311
96415b49
JK
312 if (data->exclude_filters.nr) {
313 struct string_list_item *item;
314
315 for_each_string_list_item(item, &data->exclude_filters) {
316 if (subpath_matches(path, item->string) >= 0)
317 return 0;
318 }
319 }
320
290be667
JK
321 if (data->ref_filters.nr) {
322 struct string_list_item *item;
323 int matched = 0;
324
325 /* See if any of the patterns match. */
326 for_each_string_list_item(item, &data->ref_filters) {
327 /*
328 * Check all patterns even after finding a match, so
329 * that we can see if a match with a subpath exists.
330 * When a user asked for 'refs/tags/v*' and 'v1.*',
331 * both of which match, the user is showing her
332 * willingness to accept a shortened output by having
333 * the 'v1.*' in the acceptable refnames, so we
334 * shouldn't stop when seeing 'refs/tags/v1.4' matches
335 * 'refs/tags/v*'. We should show it as 'v1.4'.
336 */
337 switch (subpath_matches(path, item->string)) {
338 case -1: /* did not match */
339 break;
340 case 0: /* matched fully */
341 matched = 1;
342 break;
343 default: /* matched subpath */
344 matched = 1;
345 can_abbreviate_output = 1;
346 break;
347 }
98c5c4ad 348 }
290be667
JK
349
350 /* If none of the patterns matched, stop now */
351 if (!matched)
352 return 0;
98c5c4ad 353 }
bd321bcc 354
1974632c 355 while (o && o->type == OBJ_TAG) {
bd321bcc
JS
356 struct tag *t = (struct tag *) o;
357 if (!t->tagged)
358 break; /* broken repository */
109cd76d 359 o = parse_object(the_repository, &t->tagged->oid);
bd321bcc 360 deref = 1;
75504248 361 taggerdate = t->date;
bd321bcc 362 }
1974632c 363 if (o && o->type == OBJ_COMMIT) {
079f9709
RS
364 commit = (struct commit *)o;
365 from_tag = starts_with(path, "refs/tags/");
5554451d 366 if (taggerdate == TIME_MAX)
e0c4da6f 367 taggerdate = commit->date;
bd321bcc 368 }
079f9709
RS
369
370 add_to_tip_table(oid, path, can_abbreviate_output, commit, taggerdate,
371 from_tag, deref);
bd321bcc
JS
372 return 0;
373}
374
079f9709
RS
375static void name_tips(void)
376{
377 int i;
378
379 /*
380 * Try to set better names first, so that worse ones spread
381 * less.
382 */
383 QSORT(tip_table.table, tip_table.nr, cmp_by_tag_and_age);
384 for (i = 0; i < tip_table.nr; i++) {
385 struct tip_table_entry *e = &tip_table.table[i];
386 if (e->commit) {
387 name_rev(e->commit, e->refname, e->taggerdate,
388 e->from_tag, e->deref);
389 }
390 }
391}
392
b23e0b93
JH
393static const unsigned char *nth_tip_table_ent(size_t ix, void *table_)
394{
395 struct tip_table_entry *table = table_;
511dca80 396 return table[ix].oid.hash;
b23e0b93
JH
397}
398
399static const char *get_exact_ref_match(const struct object *o)
400{
401 int found;
402
403 if (!tip_table.table || !tip_table.nr)
404 return NULL;
405
406 if (!tip_table.sorted) {
9ed0d8d6 407 QSORT(tip_table.table, tip_table.nr, tipcmp);
b23e0b93
JH
408 tip_table.sorted = 1;
409 }
410
ed1c9977 411 found = sha1_pos(o->oid.hash, tip_table.table, tip_table.nr,
b23e0b93
JH
412 nth_tip_table_ent);
413 if (0 <= found)
414 return tip_table.table[found].refname;
415 return NULL;
416}
417
903fc7da
JK
418/* may return a constant string or use "buf" as scratch space */
419static const char *get_rev_name(const struct object *o, struct strbuf *buf)
bd321bcc 420{
d3ff6f55 421 struct rev_name *n;
36d2419c 422 const struct commit *c;
d3ff6f55 423
1974632c 424 if (o->type != OBJ_COMMIT)
b23e0b93 425 return get_exact_ref_match(o);
36d2419c 426 c = (const struct commit *) o;
8fd79a73 427 n = get_commit_rev_name(c);
bd321bcc 428 if (!n)
a2cf9f44 429 return NULL;
bd321bcc
JS
430
431 if (!n->generation)
432 return n->tip_name;
59d3f541 433 else {
903fc7da 434 strbuf_reset(buf);
c3794d4c
RS
435 strbuf_addstr(buf, n->tip_name);
436 strbuf_strip_suffix(buf, "^0");
437 strbuf_addf(buf, "~%d", n->generation);
903fc7da 438 return buf->buf;
59d3f541 439 }
bd321bcc 440}
1f1e895f 441
da2478db
JH
442static void show_name(const struct object *obj,
443 const char *caller_name,
444 int always, int allow_undefined, int name_only)
445{
446 const char *name;
f2fd0760 447 const struct object_id *oid = &obj->oid;
903fc7da 448 struct strbuf buf = STRBUF_INIT;
da2478db
JH
449
450 if (!name_only)
f2fd0760 451 printf("%s ", caller_name ? caller_name : oid_to_hex(oid));
903fc7da 452 name = get_rev_name(obj, &buf);
da2478db
JH
453 if (name)
454 printf("%s\n", name);
455 else if (allow_undefined)
456 printf("undefined\n");
457 else if (always)
aab9583f 458 printf("%s\n", find_unique_abbrev(oid, DEFAULT_ABBREV));
da2478db 459 else
f2fd0760 460 die("cannot describe '%s'", oid_to_hex(oid));
903fc7da 461 strbuf_release(&buf);
da2478db
JH
462}
463
edefb1a2 464static char const * const name_rev_usage[] = {
9c9b4f2f
AH
465 N_("git name-rev [<options>] <commit>..."),
466 N_("git name-rev [<options>] --all"),
467 N_("git name-rev [<options>] --stdin"),
edefb1a2
PH
468 NULL
469};
470
e8b55fab
JH
471static void name_rev_line(char *p, struct name_ref_data *data)
472{
903fc7da 473 struct strbuf buf = STRBUF_INIT;
1c4675dc 474 int counter = 0;
e8b55fab 475 char *p_start;
1c4675dc 476 const unsigned hexsz = the_hash_algo->hexsz;
477
e8b55fab
JH
478 for (p_start = p; *p; p++) {
479#define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f'))
480 if (!ishex(*p))
1c4675dc 481 counter = 0;
482 else if (++counter == hexsz &&
e8b55fab 483 !ishex(*(p+1))) {
511dca80 484 struct object_id oid;
e8b55fab
JH
485 const char *name = NULL;
486 char c = *(p+1);
7c5b1675 487 int p_len = p - p_start + 1;
e8b55fab 488
1c4675dc 489 counter = 0;
e8b55fab
JH
490
491 *(p+1) = 0;
1c4675dc 492 if (!get_oid(p - (hexsz - 1), &oid)) {
e8b55fab 493 struct object *o =
d0229abd 494 lookup_object(the_repository, &oid);
e8b55fab 495 if (o)
903fc7da 496 name = get_rev_name(o, &buf);
e8b55fab
JH
497 }
498 *(p+1) = c;
499
500 if (!name)
501 continue;
502
7c5b1675 503 if (data->name_only)
1c4675dc 504 printf("%.*s%s", p_len - hexsz, p_start, name);
7c5b1675
RS
505 else
506 printf("%.*s (%s)", p_len, p_start, name);
e8b55fab
JH
507 p_start = p + 1;
508 }
509 }
510
511 /* flush */
512 if (p_start != p)
513 fwrite(p_start, p - p_start, 1, stdout);
903fc7da
JK
514
515 strbuf_release(&buf);
e8b55fab
JH
516}
517
d6b64ed0 518int cmd_name_rev(int argc, const char **argv, const char *prefix)
bd321bcc 519{
3cd47459 520 struct object_array revs = OBJECT_ARRAY_INIT;
adfc1857 521 int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0;
96415b49 522 struct name_ref_data data = { 0, 0, STRING_LIST_INIT_NODUP, STRING_LIST_INIT_NODUP };
edefb1a2 523 struct option opts[] = {
d5d09d47
SB
524 OPT_BOOL(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")),
525 OPT_BOOL(0, "tags", &data.tags_only, N_("only use tags to name the commits")),
290be667 526 OPT_STRING_LIST(0, "refs", &data.ref_filters, N_("pattern"),
422cad0a 527 N_("only use refs matching <pattern>")),
96415b49
JK
528 OPT_STRING_LIST(0, "exclude", &data.exclude_filters, N_("pattern"),
529 N_("ignore refs matching <pattern>")),
edefb1a2 530 OPT_GROUP(""),
d5d09d47
SB
531 OPT_BOOL(0, "all", &all, N_("list all commits reachable from all refs")),
532 OPT_BOOL(0, "stdin", &transform_stdin, N_("read from stdin")),
533 OPT_BOOL(0, "undefined", &allow_undefined, N_("allow to print `undefined` names (default)")),
534 OPT_BOOL(0, "always", &always,
422cad0a 535 N_("show abbreviated commit object as fallback")),
adfc1857
JH
536 {
537 /* A Hidden OPT_BOOL */
538 OPTION_SET_INT, 0, "peel-tag", &peel_tag, NULL,
539 N_("dereference tags in the input (internal use)"),
540 PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1,
541 },
edefb1a2
PH
542 OPT_END(),
543 };
bd321bcc 544
8fd79a73 545 init_commit_rev_name(&rev_names);
ef90d6d4 546 git_config(git_default_config, NULL);
37782920 547 argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
05efb7b7 548 if (all + transform_stdin + !!argc > 1) {
edefb1a2
PH
549 error("Specify either a list, or --all, not both!");
550 usage_with_options(name_rev_usage, opts);
551 }
552 if (all || transform_stdin)
553 cutoff = 0;
bd321bcc 554
edefb1a2 555 for (; argc; argc--, argv++) {
511dca80 556 struct object_id oid;
118aa4ac 557 struct object *object;
bd321bcc
JS
558 struct commit *commit;
559
511dca80 560 if (get_oid(*argv, &oid)) {
bd321bcc
JS
561 fprintf(stderr, "Could not get sha1 for %s. Skipping.\n",
562 *argv);
563 continue;
564 }
565
118aa4ac 566 commit = NULL;
109cd76d 567 object = parse_object(the_repository, &oid);
118aa4ac 568 if (object) {
a74093da
SB
569 struct object *peeled = deref_tag(the_repository,
570 object, *argv, 0);
118aa4ac
JH
571 if (peeled && peeled->type == OBJ_COMMIT)
572 commit = (struct commit *)peeled;
573 }
574
575 if (!object) {
576 fprintf(stderr, "Could not get object for %s. Skipping.\n",
bd321bcc
JS
577 *argv);
578 continue;
579 }
580
118aa4ac
JH
581 if (commit) {
582 if (cutoff > commit->date)
583 cutoff = commit->date;
584 }
adfc1857
JH
585
586 if (peel_tag) {
587 if (!commit) {
588 fprintf(stderr, "Could not get commit for %s. Skipping.\n",
589 *argv);
590 continue;
591 }
592 object = (struct object *)commit;
593 }
118aa4ac 594 add_object_array(object, *argv, &revs);
bd321bcc
JS
595 }
596
2e09c012
SG
597 if (cutoff) {
598 /* check for undeflow */
599 if (cutoff > TIME_MIN + CUTOFF_DATE_SLOP)
600 cutoff = cutoff - CUTOFF_DATE_SLOP;
601 else
602 cutoff = TIME_MIN;
603 }
73868486 604 for_each_ref(name_ref, &data);
079f9709 605 name_tips();
bd321bcc
JS
606
607 if (transform_stdin) {
608 char buffer[2048];
bd321bcc
JS
609
610 while (!feof(stdin)) {
e8b55fab 611 char *p = fgets(buffer, sizeof(buffer), stdin);
bd321bcc
JS
612 if (!p)
613 break;
e8b55fab 614 name_rev_line(p, &data);
bd321bcc
JS
615 }
616 } else if (all) {
fc046a75 617 int i, max;
bd321bcc 618
fc046a75 619 max = get_max_object_index();
a83123de
BS
620 for (i = 0; i < max; i++) {
621 struct object *obj = get_indexed_object(i);
e8b14d7e 622 if (!obj || obj->type != OBJ_COMMIT)
a83123de
BS
623 continue;
624 show_name(obj, NULL,
da2478db 625 always, allow_undefined, data.name_only);
a83123de 626 }
1f1e895f
LT
627 } else {
628 int i;
da2478db
JH
629 for (i = 0; i < revs.nr; i++)
630 show_name(revs.objects[i].item, revs.objects[i].name,
631 always, allow_undefined, data.name_only);
1f1e895f 632 }
bd321bcc 633
886e1084 634 UNLEAK(revs);
bd321bcc
JS
635 return 0;
636}