diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-08-10 21:52:34 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-08-10 21:52:35 -0700 |
| commit | 042159a5093db5da1be2a90b7c1b88441ece6029 (patch) | |
| tree | 2c196e8915418ee521839e6f8d932467d60eb905 /commit-graph.h | |
| parent | 4f049a16bf47c97639cb78b3ede3c6888fe91987 (diff) | |
| parent | 9550f6c16a8be18bd4868909d4d5e29d05bd9733 (diff) | |
Merge branch 'tb/commit-graph-genv2-upgrade-fix' into maint
There was a bug in the codepath to upgrade generation information
in commit-graph from v1 to v2 format, which has been corrected.
source: <cover.1657667404.git.me@ttaylorr.com>
* 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 2e3ac35237..f23b9e9026 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 |
