MCPcopy Create free account
hub / github.com/git/git / compare_commits_by_gen

Function compare_commits_by_gen

commit-reach.c:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22static const unsigned all_flags = (PARENT1 | PARENT2 | STALE | RESULT | ENQUEUED);
23
24static int compare_commits_by_gen(const void *_a, const void *_b)
25{
26 const struct commit *a = *(const struct commit * const *)_a;
27 const struct commit *b = *(const struct commit * const *)_b;
28
29 timestamp_t generation_a = commit_graph_generation(a);
30 timestamp_t generation_b = commit_graph_generation(b);
31
32 if (generation_a < generation_b)
33 return -1;
34 if (generation_a > generation_b)
35 return 1;
36 if (a->date < b->date)
37 return -1;
38 if (a->date > b->date)
39 return 1;
40 return 0;
41}
42
43/*
44 * A prio_queue with O(1) termination check. 'max_nonstale' tracks

Callers

nothing calls this directly

Calls 1

commit_graph_generationFunction · 0.85

Tested by

no test coverage detected