]> git.ipfire.org Git - thirdparty/git.git/blob - builtin/rev-list.c
object-name.h: move declarations for object-name.c functions from cache.h
[thirdparty/git.git] / builtin / rev-list.c
1 #include "cache.h"
2 #include "config.h"
3 #include "commit.h"
4 #include "diff.h"
5 #include "environment.h"
6 #include "gettext.h"
7 #include "hex.h"
8 #include "revision.h"
9 #include "list-objects.h"
10 #include "list-objects-filter.h"
11 #include "list-objects-filter-options.h"
12 #include "object.h"
13 #include "object-name.h"
14 #include "object-store.h"
15 #include "pack.h"
16 #include "pack-bitmap.h"
17 #include "builtin.h"
18 #include "log-tree.h"
19 #include "graph.h"
20 #include "bisect.h"
21 #include "progress.h"
22 #include "reflog-walk.h"
23 #include "oidset.h"
24 #include "packfile.h"
25
26 static const char rev_list_usage[] =
27 "git rev-list [<options>] <commit>... [--] [<path>...]\n"
28 "\n"
29 " limiting output:\n"
30 " --max-count=<n>\n"
31 " --max-age=<epoch>\n"
32 " --min-age=<epoch>\n"
33 " --sparse\n"
34 " --no-merges\n"
35 " --min-parents=<n>\n"
36 " --no-min-parents\n"
37 " --max-parents=<n>\n"
38 " --no-max-parents\n"
39 " --remove-empty\n"
40 " --all\n"
41 " --branches\n"
42 " --tags\n"
43 " --remotes\n"
44 " --stdin\n"
45 " --exclude-hidden=[fetch|receive|uploadpack]\n"
46 " --quiet\n"
47 " ordering output:\n"
48 " --topo-order\n"
49 " --date-order\n"
50 " --reverse\n"
51 " formatting output:\n"
52 " --parents\n"
53 " --children\n"
54 " --objects | --objects-edge\n"
55 " --disk-usage[=human]\n"
56 " --unpacked\n"
57 " --header | --pretty\n"
58 " --[no-]object-names\n"
59 " --abbrev=<n> | --no-abbrev\n"
60 " --abbrev-commit\n"
61 " --left-right\n"
62 " --count\n"
63 " special purpose:\n"
64 " --bisect\n"
65 " --bisect-vars\n"
66 " --bisect-all"
67 ;
68
69 static struct progress *progress;
70 static unsigned progress_counter;
71
72 static struct oidset omitted_objects;
73 static int arg_print_omitted; /* print objects omitted by filter */
74
75 static struct oidset missing_objects;
76 enum missing_action {
77 MA_ERROR = 0, /* fail if any missing objects are encountered */
78 MA_ALLOW_ANY, /* silently allow ALL missing objects */
79 MA_PRINT, /* print ALL missing objects in special section */
80 MA_ALLOW_PROMISOR, /* silently allow all missing PROMISOR objects */
81 };
82 static enum missing_action arg_missing_action;
83
84 /* display only the oid of each object encountered */
85 static int arg_show_object_names = 1;
86
87 #define DEFAULT_OIDSET_SIZE (16*1024)
88
89 static int show_disk_usage;
90 static off_t total_disk_usage;
91 static int human_readable;
92
93 static off_t get_object_disk_usage(struct object *obj)
94 {
95 off_t size;
96 struct object_info oi = OBJECT_INFO_INIT;
97 oi.disk_sizep = &size;
98 if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
99 die(_("unable to get disk usage of %s"), oid_to_hex(&obj->oid));
100 return size;
101 }
102
103 static void finish_commit(struct commit *commit);
104 static void show_commit(struct commit *commit, void *data)
105 {
106 struct rev_list_info *info = data;
107 struct rev_info *revs = info->revs;
108
109 display_progress(progress, ++progress_counter);
110
111 if (show_disk_usage)
112 total_disk_usage += get_object_disk_usage(&commit->object);
113
114 if (info->flags & REV_LIST_QUIET) {
115 finish_commit(commit);
116 return;
117 }
118
119 graph_show_commit(revs->graph);
120
121 if (revs->count) {
122 if (commit->object.flags & PATCHSAME)
123 revs->count_same++;
124 else if (commit->object.flags & SYMMETRIC_LEFT)
125 revs->count_left++;
126 else
127 revs->count_right++;
128 finish_commit(commit);
129 return;
130 }
131
132 if (info->show_timestamp)
133 printf("%"PRItime" ", commit->date);
134 if (info->header_prefix)
135 fputs(info->header_prefix, stdout);
136
137 if (revs->include_header) {
138 if (!revs->graph)
139 fputs(get_revision_mark(revs, commit), stdout);
140 if (revs->abbrev_commit && revs->abbrev)
141 fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, revs->abbrev),
142 stdout);
143 else
144 fputs(oid_to_hex(&commit->object.oid), stdout);
145 }
146 if (revs->print_parents) {
147 struct commit_list *parents = commit->parents;
148 while (parents) {
149 printf(" %s", oid_to_hex(&parents->item->object.oid));
150 parents = parents->next;
151 }
152 }
153 if (revs->children.name) {
154 struct commit_list *children;
155
156 children = lookup_decoration(&revs->children, &commit->object);
157 while (children) {
158 printf(" %s", oid_to_hex(&children->item->object.oid));
159 children = children->next;
160 }
161 }
162 show_decorations(revs, commit);
163 if (revs->commit_format == CMIT_FMT_ONELINE)
164 putchar(' ');
165 else if (revs->include_header)
166 putchar('\n');
167
168 if (revs->verbose_header) {
169 struct strbuf buf = STRBUF_INIT;
170 struct pretty_print_context ctx = {0};
171 ctx.abbrev = revs->abbrev;
172 ctx.date_mode = revs->date_mode;
173 ctx.date_mode_explicit = revs->date_mode_explicit;
174 ctx.fmt = revs->commit_format;
175 ctx.output_encoding = get_log_output_encoding();
176 ctx.color = revs->diffopt.use_color;
177 pretty_print_commit(&ctx, commit, &buf);
178 if (buf.len) {
179 if (revs->commit_format != CMIT_FMT_ONELINE)
180 graph_show_oneline(revs->graph);
181
182 graph_show_commit_msg(revs->graph, stdout, &buf);
183
184 /*
185 * Add a newline after the commit message.
186 *
187 * Usually, this newline produces a blank
188 * padding line between entries, in which case
189 * we need to add graph padding on this line.
190 *
191 * However, the commit message may not end in a
192 * newline. In this case the newline simply
193 * ends the last line of the commit message,
194 * and we don't need any graph output. (This
195 * always happens with CMIT_FMT_ONELINE, and it
196 * happens with CMIT_FMT_USERFORMAT when the
197 * format doesn't explicitly end in a newline.)
198 */
199 if (buf.len && buf.buf[buf.len - 1] == '\n')
200 graph_show_padding(revs->graph);
201 putchar(info->hdr_termination);
202 } else {
203 /*
204 * If the message buffer is empty, just show
205 * the rest of the graph output for this
206 * commit.
207 */
208 if (graph_show_remainder(revs->graph))
209 putchar('\n');
210 if (revs->commit_format == CMIT_FMT_ONELINE)
211 putchar('\n');
212 }
213 strbuf_release(&buf);
214 } else {
215 if (graph_show_remainder(revs->graph))
216 putchar('\n');
217 }
218 maybe_flush_or_die(stdout, "stdout");
219 finish_commit(commit);
220 }
221
222 static void finish_commit(struct commit *commit)
223 {
224 free_commit_list(commit->parents);
225 commit->parents = NULL;
226 free_commit_buffer(the_repository->parsed_objects,
227 commit);
228 }
229
230 static inline void finish_object__ma(struct object *obj)
231 {
232 /*
233 * Whether or not we try to dynamically fetch missing objects
234 * from the server, we currently DO NOT have the object. We
235 * can either print, allow (ignore), or conditionally allow
236 * (ignore) them.
237 */
238 switch (arg_missing_action) {
239 case MA_ERROR:
240 die("missing %s object '%s'",
241 type_name(obj->type), oid_to_hex(&obj->oid));
242 return;
243
244 case MA_ALLOW_ANY:
245 return;
246
247 case MA_PRINT:
248 oidset_insert(&missing_objects, &obj->oid);
249 return;
250
251 case MA_ALLOW_PROMISOR:
252 if (is_promisor_object(&obj->oid))
253 return;
254 die("unexpected missing %s object '%s'",
255 type_name(obj->type), oid_to_hex(&obj->oid));
256 return;
257
258 default:
259 BUG("unhandled missing_action");
260 return;
261 }
262 }
263
264 static int finish_object(struct object *obj, const char *name UNUSED,
265 void *cb_data)
266 {
267 struct rev_list_info *info = cb_data;
268 if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
269 finish_object__ma(obj);
270 return 1;
271 }
272 if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
273 parse_object(the_repository, &obj->oid);
274 return 0;
275 }
276
277 static void show_object(struct object *obj, const char *name, void *cb_data)
278 {
279 struct rev_list_info *info = cb_data;
280 struct rev_info *revs = info->revs;
281
282 if (finish_object(obj, name, cb_data))
283 return;
284 display_progress(progress, ++progress_counter);
285 if (show_disk_usage)
286 total_disk_usage += get_object_disk_usage(obj);
287 if (info->flags & REV_LIST_QUIET)
288 return;
289
290 if (revs->count) {
291 /*
292 * The object count is always accumulated in the .count_right
293 * field for traversal that is not a left-right traversal,
294 * and cmd_rev_list() made sure that a .count request that
295 * wants to count non-commit objects, which is handled by
296 * the show_object() callback, does not ask for .left_right.
297 */
298 revs->count_right++;
299 return;
300 }
301
302 if (arg_show_object_names)
303 show_object_with_name(stdout, obj, name);
304 else
305 printf("%s\n", oid_to_hex(&obj->oid));
306 }
307
308 static void show_edge(struct commit *commit)
309 {
310 printf("-%s\n", oid_to_hex(&commit->object.oid));
311 }
312
313 static void print_var_str(const char *var, const char *val)
314 {
315 printf("%s='%s'\n", var, val);
316 }
317
318 static void print_var_int(const char *var, int val)
319 {
320 printf("%s=%d\n", var, val);
321 }
322
323 static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
324 {
325 int cnt, flags = info->flags;
326 char hex[GIT_MAX_HEXSZ + 1] = "";
327 struct commit_list *tried;
328 struct rev_info *revs = info->revs;
329
330 if (!revs->commits)
331 return 1;
332
333 revs->commits = filter_skipped(revs->commits, &tried,
334 flags & BISECT_SHOW_ALL,
335 NULL, NULL);
336
337 /*
338 * revs->commits can reach "reaches" commits among
339 * "all" commits. If it is good, then there are
340 * (all-reaches) commits left to be bisected.
341 * On the other hand, if it is bad, then the set
342 * to bisect is "reaches".
343 * A bisect set of size N has (N-1) commits further
344 * to test, as we already know one bad one.
345 */
346 cnt = all - reaches;
347 if (cnt < reaches)
348 cnt = reaches;
349
350 if (revs->commits)
351 oid_to_hex_r(hex, &revs->commits->item->object.oid);
352
353 if (flags & BISECT_SHOW_ALL) {
354 traverse_commit_list(revs, show_commit, show_object, info);
355 printf("------\n");
356 }
357
358 print_var_str("bisect_rev", hex);
359 print_var_int("bisect_nr", cnt - 1);
360 print_var_int("bisect_good", all - reaches - 1);
361 print_var_int("bisect_bad", reaches - 1);
362 print_var_int("bisect_all", all);
363 print_var_int("bisect_steps", estimate_bisect_steps(all));
364
365 return 0;
366 }
367
368 static int show_object_fast(
369 const struct object_id *oid,
370 enum object_type type UNUSED,
371 int exclude UNUSED,
372 uint32_t name_hash UNUSED,
373 struct packed_git *found_pack UNUSED,
374 off_t found_offset UNUSED)
375 {
376 fprintf(stdout, "%s\n", oid_to_hex(oid));
377 return 1;
378 }
379
380 static void print_disk_usage(off_t size)
381 {
382 struct strbuf sb = STRBUF_INIT;
383 if (human_readable)
384 strbuf_humanise_bytes(&sb, size);
385 else
386 strbuf_addf(&sb, "%"PRIuMAX, (uintmax_t)size);
387 puts(sb.buf);
388 strbuf_release(&sb);
389 }
390
391 static inline int parse_missing_action_value(const char *value)
392 {
393 if (!strcmp(value, "error")) {
394 arg_missing_action = MA_ERROR;
395 return 1;
396 }
397
398 if (!strcmp(value, "allow-any")) {
399 arg_missing_action = MA_ALLOW_ANY;
400 fetch_if_missing = 0;
401 return 1;
402 }
403
404 if (!strcmp(value, "print")) {
405 arg_missing_action = MA_PRINT;
406 fetch_if_missing = 0;
407 return 1;
408 }
409
410 if (!strcmp(value, "allow-promisor")) {
411 arg_missing_action = MA_ALLOW_PROMISOR;
412 fetch_if_missing = 0;
413 return 1;
414 }
415
416 return 0;
417 }
418
419 static int try_bitmap_count(struct rev_info *revs,
420 int filter_provided_objects)
421 {
422 uint32_t commit_count = 0,
423 tag_count = 0,
424 tree_count = 0,
425 blob_count = 0;
426 int max_count;
427 struct bitmap_index *bitmap_git;
428
429 /* This function only handles counting, not general traversal. */
430 if (!revs->count)
431 return -1;
432
433 /*
434 * A bitmap result can't know left/right, etc, because we don't
435 * actually traverse.
436 */
437 if (revs->left_right || revs->cherry_mark)
438 return -1;
439
440 /*
441 * If we're counting reachable objects, we can't handle a max count of
442 * commits to traverse, since we don't know which objects go with which
443 * commit.
444 */
445 if (revs->max_count >= 0 &&
446 (revs->tag_objects || revs->tree_objects || revs->blob_objects))
447 return -1;
448
449 /*
450 * This must be saved before doing any walking, since the revision
451 * machinery will count it down to zero while traversing.
452 */
453 max_count = revs->max_count;
454
455 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
456 if (!bitmap_git)
457 return -1;
458
459 count_bitmap_commit_list(bitmap_git, &commit_count,
460 revs->tree_objects ? &tree_count : NULL,
461 revs->blob_objects ? &blob_count : NULL,
462 revs->tag_objects ? &tag_count : NULL);
463 if (max_count >= 0 && max_count < commit_count)
464 commit_count = max_count;
465
466 printf("%d\n", commit_count + tree_count + blob_count + tag_count);
467 free_bitmap_index(bitmap_git);
468 return 0;
469 }
470
471 static int try_bitmap_traversal(struct rev_info *revs,
472 int filter_provided_objects)
473 {
474 struct bitmap_index *bitmap_git;
475
476 /*
477 * We can't use a bitmap result with a traversal limit, since the set
478 * of commits we'd get would be essentially random.
479 */
480 if (revs->max_count >= 0)
481 return -1;
482
483 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
484 if (!bitmap_git)
485 return -1;
486
487 traverse_bitmap_commit_list(bitmap_git, revs, &show_object_fast);
488 free_bitmap_index(bitmap_git);
489 return 0;
490 }
491
492 static int try_bitmap_disk_usage(struct rev_info *revs,
493 int filter_provided_objects)
494 {
495 struct bitmap_index *bitmap_git;
496 off_t size_from_bitmap;
497
498 if (!show_disk_usage)
499 return -1;
500
501 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
502 if (!bitmap_git)
503 return -1;
504
505 size_from_bitmap = get_disk_usage_from_bitmap(bitmap_git, revs);
506 print_disk_usage(size_from_bitmap);
507 return 0;
508 }
509
510 int cmd_rev_list(int argc, const char **argv, const char *prefix)
511 {
512 struct rev_info revs;
513 struct rev_list_info info;
514 struct setup_revision_opt s_r_opt = {
515 .allow_exclude_promisor_objects = 1,
516 };
517 int i;
518 int bisect_list = 0;
519 int bisect_show_vars = 0;
520 int bisect_find_all = 0;
521 int use_bitmap_index = 0;
522 int filter_provided_objects = 0;
523 const char *show_progress = NULL;
524 int ret = 0;
525
526 if (argc == 2 && !strcmp(argv[1], "-h"))
527 usage(rev_list_usage);
528
529 git_config(git_default_config, NULL);
530 repo_init_revisions(the_repository, &revs, prefix);
531 revs.abbrev = DEFAULT_ABBREV;
532 revs.commit_format = CMIT_FMT_UNSPECIFIED;
533 revs.include_header = 1;
534
535 /*
536 * Scan the argument list before invoking setup_revisions(), so that we
537 * know if fetch_if_missing needs to be set to 0.
538 *
539 * "--exclude-promisor-objects" acts as a pre-filter on missing objects
540 * by not crossing the boundary from realized objects to promisor
541 * objects.
542 *
543 * Let "--missing" to conditionally set fetch_if_missing.
544 */
545 for (i = 1; i < argc; i++) {
546 const char *arg = argv[i];
547 if (!strcmp(arg, "--exclude-promisor-objects")) {
548 fetch_if_missing = 0;
549 revs.exclude_promisor_objects = 1;
550 break;
551 }
552 }
553 for (i = 1; i < argc; i++) {
554 const char *arg = argv[i];
555 if (skip_prefix(arg, "--missing=", &arg)) {
556 if (revs.exclude_promisor_objects)
557 die(_("options '%s' and '%s' cannot be used together"), "--exclude-promisor-objects", "--missing");
558 if (parse_missing_action_value(arg))
559 break;
560 }
561 }
562
563 if (arg_missing_action)
564 revs.do_not_die_on_missing_tree = 1;
565
566 argc = setup_revisions(argc, argv, &revs, &s_r_opt);
567
568 memset(&info, 0, sizeof(info));
569 info.revs = &revs;
570 if (revs.bisect)
571 bisect_list = 1;
572
573 if (revs.diffopt.flags.quick)
574 info.flags |= REV_LIST_QUIET;
575 for (i = 1 ; i < argc; i++) {
576 const char *arg = argv[i];
577
578 if (!strcmp(arg, "--header")) {
579 revs.verbose_header = 1;
580 continue;
581 }
582 if (!strcmp(arg, "--timestamp")) {
583 info.show_timestamp = 1;
584 continue;
585 }
586 if (!strcmp(arg, "--bisect")) {
587 bisect_list = 1;
588 continue;
589 }
590 if (!strcmp(arg, "--bisect-all")) {
591 bisect_list = 1;
592 bisect_find_all = 1;
593 info.flags |= BISECT_SHOW_ALL;
594 revs.show_decorations = 1;
595 continue;
596 }
597 if (!strcmp(arg, "--bisect-vars")) {
598 bisect_list = 1;
599 bisect_show_vars = 1;
600 continue;
601 }
602 if (!strcmp(arg, "--use-bitmap-index")) {
603 use_bitmap_index = 1;
604 continue;
605 }
606 if (!strcmp(arg, "--test-bitmap")) {
607 test_bitmap_walk(&revs);
608 goto cleanup;
609 }
610 if (skip_prefix(arg, "--progress=", &arg)) {
611 show_progress = arg;
612 continue;
613 }
614 if (!strcmp(arg, "--filter-provided-objects")) {
615 filter_provided_objects = 1;
616 continue;
617 }
618 if (!strcmp(arg, "--filter-print-omitted")) {
619 arg_print_omitted = 1;
620 continue;
621 }
622
623 if (!strcmp(arg, "--exclude-promisor-objects"))
624 continue; /* already handled above */
625 if (skip_prefix(arg, "--missing=", &arg))
626 continue; /* already handled above */
627
628 if (!strcmp(arg, ("--no-object-names"))) {
629 arg_show_object_names = 0;
630 continue;
631 }
632
633 if (!strcmp(arg, ("--object-names"))) {
634 arg_show_object_names = 1;
635 continue;
636 }
637
638 if (!strcmp(arg, ("--commit-header"))) {
639 revs.include_header = 1;
640 continue;
641 }
642
643 if (!strcmp(arg, ("--no-commit-header"))) {
644 revs.include_header = 0;
645 continue;
646 }
647
648 if (skip_prefix(arg, "--disk-usage", &arg)) {
649 if (*arg == '=') {
650 if (!strcmp(++arg, "human")) {
651 human_readable = 1;
652 } else
653 die(_("invalid value for '%s': '%s', the only allowed format is '%s'"),
654 "--disk-usage=<format>", arg, "human");
655 } else if (*arg) {
656 /*
657 * Arguably should goto a label to continue chain of ifs?
658 * Doesn't matter unless we try to add --disk-usage-foo
659 * afterwards.
660 */
661 usage(rev_list_usage);
662 }
663 show_disk_usage = 1;
664 info.flags |= REV_LIST_QUIET;
665 continue;
666 }
667
668 usage(rev_list_usage);
669
670 }
671 if (revs.commit_format != CMIT_FMT_USERFORMAT)
672 revs.include_header = 1;
673 if (revs.commit_format != CMIT_FMT_UNSPECIFIED) {
674 /* The command line has a --pretty */
675 info.hdr_termination = '\n';
676 if (revs.commit_format == CMIT_FMT_ONELINE || !revs.include_header)
677 info.header_prefix = "";
678 else
679 info.header_prefix = "commit ";
680 }
681 else if (revs.verbose_header)
682 /* Only --header was specified */
683 revs.commit_format = CMIT_FMT_RAW;
684
685 if ((!revs.commits && reflog_walk_empty(revs.reflog_info) &&
686 (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
687 !revs.pending.nr) &&
688 !revs.rev_input_given && !revs.read_from_stdin) ||
689 revs.diff)
690 usage(rev_list_usage);
691
692 if (revs.show_notes)
693 die(_("rev-list does not support display of notes"));
694
695 if (revs.count &&
696 (revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
697 (revs.left_right || revs.cherry_mark))
698 die(_("marked counting and '%s' cannot be used together"), "--objects");
699
700 save_commit_buffer = (revs.verbose_header ||
701 revs.grep_filter.pattern_list ||
702 revs.grep_filter.header_list);
703 if (bisect_list)
704 revs.limited = 1;
705
706 if (show_progress)
707 progress = start_delayed_progress(show_progress, 0);
708
709 if (use_bitmap_index) {
710 if (!try_bitmap_count(&revs, filter_provided_objects))
711 goto cleanup;
712 if (!try_bitmap_disk_usage(&revs, filter_provided_objects))
713 goto cleanup;
714 if (!try_bitmap_traversal(&revs, filter_provided_objects))
715 goto cleanup;
716 }
717
718 if (prepare_revision_walk(&revs))
719 die("revision walk setup failed");
720 if (revs.tree_objects)
721 mark_edges_uninteresting(&revs, show_edge, 0);
722
723 if (bisect_list) {
724 int reaches, all;
725 unsigned bisect_flags = 0;
726
727 if (bisect_find_all)
728 bisect_flags |= FIND_BISECTION_ALL;
729
730 if (revs.first_parent_only)
731 bisect_flags |= FIND_BISECTION_FIRST_PARENT_ONLY;
732
733 find_bisection(&revs.commits, &reaches, &all, bisect_flags);
734
735 if (bisect_show_vars) {
736 ret = show_bisect_vars(&info, reaches, all);
737 goto cleanup;
738 }
739 }
740
741 if (filter_provided_objects) {
742 struct commit_list *c;
743 for (i = 0; i < revs.pending.nr; i++) {
744 struct object_array_entry *pending = revs.pending.objects + i;
745 pending->item->flags |= NOT_USER_GIVEN;
746 }
747 for (c = revs.commits; c; c = c->next)
748 c->item->object.flags |= NOT_USER_GIVEN;
749 }
750
751 if (arg_print_omitted)
752 oidset_init(&omitted_objects, DEFAULT_OIDSET_SIZE);
753 if (arg_missing_action == MA_PRINT)
754 oidset_init(&missing_objects, DEFAULT_OIDSET_SIZE);
755
756 traverse_commit_list_filtered(
757 &revs, show_commit, show_object, &info,
758 (arg_print_omitted ? &omitted_objects : NULL));
759
760 if (arg_print_omitted) {
761 struct oidset_iter iter;
762 struct object_id *oid;
763 oidset_iter_init(&omitted_objects, &iter);
764 while ((oid = oidset_iter_next(&iter)))
765 printf("~%s\n", oid_to_hex(oid));
766 oidset_clear(&omitted_objects);
767 }
768 if (arg_missing_action == MA_PRINT) {
769 struct oidset_iter iter;
770 struct object_id *oid;
771 oidset_iter_init(&missing_objects, &iter);
772 while ((oid = oidset_iter_next(&iter)))
773 printf("?%s\n", oid_to_hex(oid));
774 oidset_clear(&missing_objects);
775 }
776
777 stop_progress(&progress);
778
779 if (revs.count) {
780 if (revs.left_right && revs.cherry_mark)
781 printf("%d\t%d\t%d\n", revs.count_left, revs.count_right, revs.count_same);
782 else if (revs.left_right)
783 printf("%d\t%d\n", revs.count_left, revs.count_right);
784 else if (revs.cherry_mark)
785 printf("%d\t%d\n", revs.count_left + revs.count_right, revs.count_same);
786 else
787 printf("%d\n", revs.count_left + revs.count_right);
788 }
789
790 if (show_disk_usage)
791 print_disk_usage(total_disk_usage);
792
793 cleanup:
794 release_revisions(&revs);
795 return ret;
796 }