@@ -292,7 +292,8 @@ static int bsearch_graph(struct commit_graph *g, struct object_id *oid, uint32_t
292
292
g -> chunk_oid_lookup , g -> hash_len , pos );
293
293
}
294
294
295
- static struct commit_list * * insert_parent_or_die (struct commit_graph * g ,
295
+ static struct commit_list * * insert_parent_or_die (struct repository * r ,
296
+ struct commit_graph * g ,
296
297
uint64_t pos ,
297
298
struct commit_list * * pptr )
298
299
{
@@ -303,7 +304,7 @@ static struct commit_list **insert_parent_or_die(struct commit_graph *g,
303
304
die ("invalid parent position %" PRIu64 , pos );
304
305
305
306
hashcpy (oid .hash , g -> chunk_oid_lookup + g -> hash_len * pos );
306
- c = lookup_commit (the_repository , & oid );
307
+ c = lookup_commit (r , & oid );
307
308
if (!c )
308
309
die (_ ("could not find commit %s" ), oid_to_hex (& oid ));
309
310
c -> graph_pos = pos ;
@@ -317,7 +318,9 @@ static void fill_commit_graph_info(struct commit *item, struct commit_graph *g,
317
318
item -> generation = get_be32 (commit_data + g -> hash_len + 8 ) >> 2 ;
318
319
}
319
320
320
- static int fill_commit_in_graph (struct commit * item , struct commit_graph * g , uint32_t pos )
321
+ static int fill_commit_in_graph (struct repository * r ,
322
+ struct commit * item ,
323
+ struct commit_graph * g , uint32_t pos )
321
324
{
322
325
uint32_t edge_value ;
323
326
uint32_t * parent_data_ptr ;
@@ -341,21 +344,21 @@ static int fill_commit_in_graph(struct commit *item, struct commit_graph *g, uin
341
344
edge_value = get_be32 (commit_data + g -> hash_len );
342
345
if (edge_value == GRAPH_PARENT_NONE )
343
346
return 1 ;
344
- pptr = insert_parent_or_die (g , edge_value , pptr );
347
+ pptr = insert_parent_or_die (r , g , edge_value , pptr );
345
348
346
349
edge_value = get_be32 (commit_data + g -> hash_len + 4 );
347
350
if (edge_value == GRAPH_PARENT_NONE )
348
351
return 1 ;
349
352
if (!(edge_value & GRAPH_OCTOPUS_EDGES_NEEDED )) {
350
- pptr = insert_parent_or_die (g , edge_value , pptr );
353
+ pptr = insert_parent_or_die (r , g , edge_value , pptr );
351
354
return 1 ;
352
355
}
353
356
354
357
parent_data_ptr = (uint32_t * )(g -> chunk_large_edges +
355
358
4 * (uint64_t )(edge_value & GRAPH_EDGE_LAST_MASK ));
356
359
do {
357
360
edge_value = get_be32 (parent_data_ptr );
358
- pptr = insert_parent_or_die (g ,
361
+ pptr = insert_parent_or_die (r , g ,
359
362
edge_value & GRAPH_EDGE_LAST_MASK ,
360
363
pptr );
361
364
parent_data_ptr ++ ;
@@ -374,15 +377,17 @@ static int find_commit_in_graph(struct commit *item, struct commit_graph *g, uin
374
377
}
375
378
}
376
379
377
- static int parse_commit_in_graph_one (struct commit_graph * g , struct commit * item )
380
+ static int parse_commit_in_graph_one (struct repository * r ,
381
+ struct commit_graph * g ,
382
+ struct commit * item )
378
383
{
379
384
uint32_t pos ;
380
385
381
386
if (item -> object .parsed )
382
387
return 1 ;
383
388
384
389
if (find_commit_in_graph (item , g , & pos ))
385
- return fill_commit_in_graph (item , g , pos );
390
+ return fill_commit_in_graph (r , item , g , pos );
386
391
387
392
return 0 ;
388
393
}
@@ -391,7 +396,7 @@ int parse_commit_in_graph(struct repository *r, struct commit *item)
391
396
{
392
397
if (!prepare_commit_graph (r ))
393
398
return 0 ;
394
- return parse_commit_in_graph_one (r -> objects -> commit_graph , item );
399
+ return parse_commit_in_graph_one (r , r -> objects -> commit_graph , item );
395
400
}
396
401
397
402
void load_commit_graph_info (struct repository * r , struct commit * item )
@@ -403,32 +408,35 @@ void load_commit_graph_info(struct repository *r, struct commit *item)
403
408
fill_commit_graph_info (item , r -> objects -> commit_graph , pos );
404
409
}
405
410
406
- static struct tree * load_tree_for_commit (struct commit_graph * g , struct commit * c )
411
+ static struct tree * load_tree_for_commit (struct repository * r ,
412
+ struct commit_graph * g ,
413
+ struct commit * c )
407
414
{
408
415
struct object_id oid ;
409
416
const unsigned char * commit_data = g -> chunk_commit_data +
410
417
GRAPH_DATA_WIDTH * (c -> graph_pos );
411
418
412
419
hashcpy (oid .hash , commit_data );
413
- c -> maybe_tree = lookup_tree (the_repository , & oid );
420
+ c -> maybe_tree = lookup_tree (r , & oid );
414
421
415
422
return c -> maybe_tree ;
416
423
}
417
424
418
- static struct tree * get_commit_tree_in_graph_one (struct commit_graph * g ,
425
+ static struct tree * get_commit_tree_in_graph_one (struct repository * r ,
426
+ struct commit_graph * g ,
419
427
const struct commit * c )
420
428
{
421
429
if (c -> maybe_tree )
422
430
return c -> maybe_tree ;
423
431
if (c -> graph_pos == COMMIT_NOT_FROM_GRAPH )
424
432
BUG ("get_commit_tree_in_graph_one called from non-commit-graph commit" );
425
433
426
- return load_tree_for_commit (g , (struct commit * )c );
434
+ return load_tree_for_commit (r , g , (struct commit * )c );
427
435
}
428
436
429
437
struct tree * get_commit_tree_in_graph (struct repository * r , const struct commit * c )
430
438
{
431
- return get_commit_tree_in_graph_one (r -> objects -> commit_graph , c );
439
+ return get_commit_tree_in_graph_one (r , r -> objects -> commit_graph , c );
432
440
}
433
441
434
442
static void write_graph_chunk_fanout (struct hashfile * f ,
@@ -1025,7 +1033,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
1025
1033
}
1026
1034
1027
1035
graph_commit = lookup_commit (r , & cur_oid );
1028
- if (!parse_commit_in_graph_one (g , graph_commit ))
1036
+ if (!parse_commit_in_graph_one (r , g , graph_commit ))
1029
1037
graph_report ("failed to parse %s from commit-graph" ,
1030
1038
oid_to_hex (& cur_oid ));
1031
1039
}
@@ -1061,7 +1069,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
1061
1069
continue ;
1062
1070
}
1063
1071
1064
- if (!oideq (& get_commit_tree_in_graph_one (g , graph_commit )-> object .oid ,
1072
+ if (!oideq (& get_commit_tree_in_graph_one (r , g , graph_commit )-> object .oid ,
1065
1073
get_commit_tree_oid (odb_commit )))
1066
1074
graph_report ("root tree OID for commit %s in commit-graph is %s != %s" ,
1067
1075
oid_to_hex (& cur_oid ),
0 commit comments