430
431
static void write_graph_chunk_fanout(struct hashfile *f,
432
struct commit **commits,
433
- int nr_commits)
433
+ int nr_commits,
434
+ struct progress *progress,
435
+ uint64_t *progress_cnt)
436
{
437
int i, count = 0;
438
struct commit **list = commits;
446
while (count < nr_commits) {
447
if ((*list)->object.oid.hash[0] != i)
448
break;
449
+ display_progress(progress, ++*progress_cnt);
450
count++;
451
list++;
452
}
456
}
457
458
static void write_graph_chunk_oids(struct hashfile *f, int hash_len,
456
- struct commit **commits, int nr_commits)
459
+ struct commit **commits, int nr_commits,
460
+ struct progress *progress,
461
+ uint64_t *progress_cnt)
462
{
463
struct commit **list = commits;
464
int count;
460
- for (count = 0; count < nr_commits; count++, list++)
465
+ for (count = 0; count < nr_commits; count++, list++) {
466
+ display_progress(progress, ++*progress_cnt);
467
hashwrite(f, (*list)->object.oid.hash, (int)hash_len);
468
+ }
469
}
470
471
static const unsigned char *commit_to_sha1(size_t index, void *table)
475
}
476
477
static void write_graph_chunk_data(struct hashfile *f, int hash_len,
471
- struct commit **commits, int nr_commits)
478
+ struct commit **commits, int nr_commits,
479
+ struct progress *progress,
480
+ uint64_t *progress_cnt)
481
{
482
struct commit **list = commits;
483
struct commit **last = commits + nr_commits;
487
struct commit_list *parent;
488
int edge_value;
489
uint32_t packedDate[2];
490
+ display_progress(progress, ++*progress_cnt);
491
492
parse_commit(*list);
493
hashwrite(f, get_commit_tree_oid(*list)->hash, hash_len);
549
550
static void write_graph_chunk_extra_edges(struct hashfile *f,
551
struct commit **commits,
542
- int nr_commits)
552
+ int nr_commits,
553
+ struct progress *progress,
554
+ uint64_t *progress_cnt)
555
{
556
struct commit **list = commits;
557
struct commit **last = commits + nr_commits;
559
560
while (list < last) {
561
int num_parents = 0;
562
+
563
+ display_progress(progress, ++*progress_cnt);
564
+
565
for (parent = (*list)->parents; num_parents < 3 && parent;
566
parent = parent->next)
567
num_parents++;
783
int num_extra_edges;
784
struct commit_list *parent;
785
struct progress *progress = NULL;
786
+ uint64_t progress_cnt = 0;
787
788
if (!commit_graph_compatible(the_repository))
789
return;
959
hashwrite(f, chunk_write, 12);
960
}
961
946
- write_graph_chunk_fanout(f, commits.list, commits.nr);
947
- write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr);
948
- write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr);
962
+ if (report_progress)
963
+ progress = start_delayed_progress(
964
+ _("Writing out commit graph"),
965
+ num_chunks * commits.nr);
966
+ write_graph_chunk_fanout(f, commits.list, commits.nr, progress, &progress_cnt);
967
+ write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr, progress, &progress_cnt);
968
+ write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr, progress, &progress_cnt);
969
if (num_extra_edges)
950
- write_graph_chunk_extra_edges(f, commits.list, commits.nr);
970
+ write_graph_chunk_extra_edges(f, commits.list, commits.nr, progress, &progress_cnt);
971
+ stop_progress(&progress);
972
973
close_commit_graph(the_repository);
974
finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC);