34
34
#define GRAPH_OID_LEN GRAPH_OID_LEN_SHA1
35
35
36
36
#define GRAPH_OCTOPUS_EDGES_NEEDED 0x80000000
37
- #define GRAPH_PARENT_MISSING 0x7fffffff
38
37
#define GRAPH_EDGE_LAST_MASK 0x7fffffff
39
38
#define GRAPH_PARENT_NONE 0x70000000
40
39
@@ -493,7 +492,9 @@ static void write_graph_chunk_data(struct hashfile *f, int hash_len,
493
492
commit_to_sha1 );
494
493
495
494
if (edge_value < 0 )
496
- edge_value = GRAPH_PARENT_MISSING ;
495
+ BUG ("missing parent %s for commit %s" ,
496
+ oid_to_hex (& parent -> item -> object .oid ),
497
+ oid_to_hex (& (* list )-> object .oid ));
497
498
}
498
499
499
500
hashwrite_be32 (f , edge_value );
@@ -511,7 +512,9 @@ static void write_graph_chunk_data(struct hashfile *f, int hash_len,
511
512
nr_commits ,
512
513
commit_to_sha1 );
513
514
if (edge_value < 0 )
514
- edge_value = GRAPH_PARENT_MISSING ;
515
+ BUG ("missing parent %s for commit %s" ,
516
+ oid_to_hex (& parent -> item -> object .oid ),
517
+ oid_to_hex (& (* list )-> object .oid ));
515
518
}
516
519
517
520
hashwrite_be32 (f , edge_value );
@@ -564,7 +567,9 @@ static void write_graph_chunk_large_edges(struct hashfile *f,
564
567
commit_to_sha1 );
565
568
566
569
if (edge_value < 0 )
567
- edge_value = GRAPH_PARENT_MISSING ;
570
+ BUG ("missing parent %s for commit %s" ,
571
+ oid_to_hex (& parent -> item -> object .oid ),
572
+ oid_to_hex (& (* list )-> object .oid ));
568
573
else if (!parent -> next )
569
574
edge_value |= GRAPH_LAST_EDGE ;
570
575
@@ -868,7 +873,7 @@ void write_commit_graph(const char *obj_dir,
868
873
count_distinct ++ ;
869
874
}
870
875
871
- if (count_distinct >= GRAPH_PARENT_MISSING )
876
+ if (count_distinct >= GRAPH_EDGE_LAST_MASK )
872
877
die (_ ("the commit graph format cannot write %d commits" ), count_distinct );
873
878
874
879
commits .nr = 0 ;
@@ -895,7 +900,7 @@ void write_commit_graph(const char *obj_dir,
895
900
}
896
901
num_chunks = num_extra_edges ? 4 : 3 ;
897
902
898
- if (commits .nr >= GRAPH_PARENT_MISSING )
903
+ if (commits .nr >= GRAPH_EDGE_LAST_MASK )
899
904
die (_ ("too many commits to write graph" ));
900
905
901
906
compute_generation_numbers (& commits , report_progress );
0 commit comments