245
return &commit_list_insert(c, pptr)->next;
246
}
247
248
+static void fill_commit_graph_info(struct commit *item, struct commit_graph *g, uint32_t pos)
249
+{
250
+ const unsigned char *commit_data = g->chunk_commit_data + GRAPH_DATA_WIDTH * pos;
251
+ item->graph_pos = pos;
252
+ item->generation = get_be32(commit_data + g->hash_len + 8) >> 2;
253
+}
254
+
255
static int fill_commit_in_graph(struct commit *item, struct commit_graph *g, uint32_t pos)
256
{
257
uint32_t edge_value;
299
return 1;
300
}
301
302
+static int find_commit_in_graph(struct commit *item, struct commit_graph *g, uint32_t *pos)
303
+{
304
+ if (item->graph_pos != COMMIT_NOT_FROM_GRAPH) {
305
+ *pos = item->graph_pos;
306
+ return 1;
307
+ } else {
308
+ return bsearch_graph(g, &(item->object.oid), pos);
309
+ }
310
+}
311
+
312
int parse_commit_in_graph(struct commit *item)
313
{
314
+ uint32_t pos;
315
+
316
if (!core_commit_graph)
317
return 0;
318
if (item->object.parsed)
319
return 1;
301
-
320
prepare_commit_graph();
303
- if (commit_graph) {
304
- uint32_t pos;
305
- int found;
306
- if (item->graph_pos != COMMIT_NOT_FROM_GRAPH) {
307
- pos = item->graph_pos;
308
- found = 1;
309
- } else {
310
- found = bsearch_graph(commit_graph, &(item->object.oid), &pos);
311
- }
312
-
313
- if (found)
314
- return fill_commit_in_graph(item, commit_graph, pos);
315
- }
316
-
321
+ if (commit_graph && find_commit_in_graph(item, commit_graph, &pos))
322
+ return fill_commit_in_graph(item, commit_graph, pos);
323
return 0;
324
}
325
326
+void load_commit_graph_info(struct commit *item)
327
+{
328
+ uint32_t pos;
329
+ if (!core_commit_graph)
330
+ return;
331
+ prepare_commit_graph();
332
+ if (commit_graph && find_commit_in_graph(item, commit_graph, &pos))
333
+ fill_commit_graph_info(item, commit_graph, pos);
334
+}
335
+
336
static struct tree *load_tree_for_commit(struct commit_graph *g, struct commit *c)
337
{
338
struct object_id oid;