diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-08-03 23:36:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-03 23:36:08 +0300 |
commit | 37e4bdd5ee5d6a7e09feaf5857299aac8fd56aeb (patch) | |
tree | 68792e9cddee8c9d9a738e2547546c7a311aa4ce /commit-graph.h | |
parent | f1a0db23ad269d46ae43fd34d04ab6065081a92f (diff) | |
parent | 9550f6c16a8be18bd4868909d4d5e29d05bd9733 (diff) |
Merge branch 'tb/commit-graph-genv2-upgrade-fix'
There was a bug in the codepath to upgrade generation information
in commit-graph from v1 to v2 format, which has been corrected.
* tb/commit-graph-genv2-upgrade-fix:
commit-graph: fix corrupt upgrade from generation v1 to v2
commit-graph: introduce `repo_find_commit_pos_in_graph()`
t5318: demonstrate commit-graph generation v2 corruption
Diffstat (limited to 'commit-graph.h')
-rw-r--r-- | commit-graph.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/commit-graph.h b/commit-graph.h index 25cdec127a..37faee6b66 100644 --- a/commit-graph.h +++ b/commit-graph.h @@ -41,6 +41,21 @@ int open_commit_graph(const char *graph_file, int *fd, struct stat *st); int parse_commit_in_graph(struct repository *r, struct commit *item); /* + * Fills `*pos` with the graph position of `c`, and returns 1 if `c` is + * found in the commit-graph belonging to `r`, or 0 otherwise. + * Initializes the commit-graph belonging to `r` if it hasn't been + * already. + * + * Note: this is a low-level helper that does not alter any slab data + * associated with `c`. Useful in circumstances where the slab data is + * already being modified (e.g., writing the commit-graph itself). + * + * In most cases, callers should use `parse_commit_in_graph()` instead. + */ +int repo_find_commit_pos_in_graph(struct repository *r, struct commit *c, + uint32_t *pos); + +/* * Look up the given commit ID in the commit-graph. This will only return a * commit if the ID exists both in the graph and in the object database such * that we don't return commits whose object has been pruned. Otherwise, this |