MCPcopy Index your code
hub / github.com/git/git / commit_gen_cmp

Function commit_gen_cmp

commit-graph.c:178–197  ·  view source on GitHub ↗

* Should be used only while writing commit-graph as it compares * generation value of commits by directly accessing commit-slab. */

Source from the content-addressed store, hash-verified

176 * generation value of commits by directly accessing commit-slab.
177 */
178static int commit_gen_cmp(const void *va, const void *vb)
179{
180 const struct commit *a = *(const struct commit **)va;
181 const struct commit *b = *(const struct commit **)vb;
182
183 const timestamp_t generation_a = commit_graph_data_at(a)->generation;
184 const timestamp_t generation_b = commit_graph_data_at(b)->generation;
185 /* lower generation commits first */
186 if (generation_a < generation_b)
187 return -1;
188 else if (generation_a > generation_b)
189 return 1;
190
191 /* use date as a heuristic when generations are equal */
192 if (a->date < b->date)
193 return -1;
194 else if (a->date > b->date)
195 return 1;
196 return 0;
197}
198
199char *get_commit_graph_filename(struct odb_source *source)
200{

Callers

nothing calls this directly

Calls 1

commit_graph_data_atFunction · 0.85

Tested by

no test coverage detected