From 1a2f960907ebeeb703c85c5d2b61de8dbd69a1b5 Mon Sep 17 00:00:00 2001 From: lhchavez Date: Tue, 5 Jan 2021 06:24:26 -0800 Subject: commit-graph: Introduce `git_commit_graph_needs_refresh()` This change introduces a function that allows the caller to know whether the `commit-graph` file has not been modified since it was parsed. Part of: #5757 --- src/commit_graph.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/commit_graph.h') diff --git a/src/commit_graph.h b/src/commit_graph.h index f3a431705..f21a03769 100644 --- a/src/commit_graph.h +++ b/src/commit_graph.h @@ -89,6 +89,14 @@ typedef struct git_commit_graph_entry { } git_commit_graph_entry; int git_commit_graph_open(git_commit_graph_file **cgraph_out, const char *path); + +/* + * Returns whether the commit_graph_file needs to be reloaded since the + * contents of the commit-graph file have changed on disk. If `path` is NULL, + * the filename stored in `cgraph` will be used. + */ +bool git_commit_graph_needs_refresh(const git_commit_graph_file *cgraph, const char *path); + int git_commit_graph_entry_find( git_commit_graph_entry *e, const git_commit_graph_file *cgraph, -- cgit v1.2.1