summaryrefslogtreecommitdiff
path: root/commit-graph.h
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2020-04-14 04:04:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-15 16:20:30 (GMT)
commit6830c360777468434184f60023e2562348c9dacc (patch)
tree1cf8125fb2e1d96f34115fee5aebae075a7ab414 /commit-graph.h
parentf4781068faafad5e10fb6e8ae312ebd5b0e7bb55 (diff)
downloadgit-6830c360777468434184f60023e2562348c9dacc.zip
git-6830c360777468434184f60023e2562348c9dacc.tar.gz
git-6830c360777468434184f60023e2562348c9dacc.tar.bz2
commit-graph.h: replace 'commit_hex' with 'commits'
The 'write_commit_graph()' function takes in either a string list of pack indices, or a string list of hexadecimal commit OIDs. These correspond to the '--stdin-packs' and '--stdin-commits' mode(s) from 'git commit-graph write'. Using a string_list of hexadecimal commit IDs is not the most efficient use of memory, since we can instead use the 'struct oidset', which is more well-suited for this case. This has another benefit which will become apparent in the following commit. This is that we are about to disambiguate the kinds of errors we produce with '--stdin-commits' into "non-hex input" and "hex-input, but referring to a non-commit object". By having 'write_commit_graph' take in a 'struct oidset *' of commits, we place the burden on the caller (in this case, the builtin) to handle the first case, and the commit-graph machinery can handle the second case. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.h')
-rw-r--r--commit-graph.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/commit-graph.h b/commit-graph.h
index 718433d..98ef121 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -6,6 +6,7 @@
#include "string-list.h"
#include "cache.h"
#include "object-store.h"
+#include "oidset.h"
#define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
#define GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD "GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD"
@@ -106,7 +107,7 @@ int write_commit_graph_reachable(struct object_directory *odb,
const struct split_commit_graph_opts *split_opts);
int write_commit_graph(struct object_directory *odb,
struct string_list *pack_indexes,
- struct string_list *commit_hex,
+ struct oidset *commits,
enum commit_graph_write_flags flags,
const struct split_commit_graph_opts *split_opts);