aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/commit-graph.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-08-22 12:34:11 -0700
committerJunio C Hamano <gitster@pobox.com>2019-08-22 12:34:11 -0700
commit6ba06b582bcf0fb4afa9fcc7d265005eb20cd50f (patch)
tree691eb351631f68e5e72707ac27197041b7775e34 /builtin/commit-graph.c
parentMerge branch 'vn/restore-empty-ita-corner-case-fix' (diff)
parentcommit-graph: error out on invalid commit oids in 'write --stdin-commits' (diff)
downloadgit-6ba06b582bcf0fb4afa9fcc7d265005eb20cd50f.tar.gz
git-6ba06b582bcf0fb4afa9fcc7d265005eb20cd50f.zip
Merge branch 'sg/commit-graph-validate'
The code to write commit-graph over given commit object names has been made a bit more robust. * sg/commit-graph-validate: commit-graph: error out on invalid commit oids in 'write --stdin-commits' commit-graph: turn a group of write-related macro flags into an enum t5318-commit-graph: use 'test_expect_code'
Diffstat (limited to 'builtin/commit-graph.c')
-rw-r--r--builtin/commit-graph.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 38027b83d9..57863619b7 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -154,7 +154,7 @@ static int graph_write(int argc, const char **argv)
struct string_list *commit_hex = NULL;
struct string_list lines;
int result = 0;
- unsigned int flags = COMMIT_GRAPH_PROGRESS;
+ enum commit_graph_write_flags flags = COMMIT_GRAPH_WRITE_PROGRESS;
static struct option builtin_commit_graph_write_options[] = {
OPT_STRING(0, "object-dir", &opts.obj_dir,
@@ -192,9 +192,9 @@ static int graph_write(int argc, const char **argv)
if (!opts.obj_dir)
opts.obj_dir = get_object_directory();
if (opts.append)
- flags |= COMMIT_GRAPH_APPEND;
+ flags |= COMMIT_GRAPH_WRITE_APPEND;
if (opts.split)
- flags |= COMMIT_GRAPH_SPLIT;
+ flags |= COMMIT_GRAPH_WRITE_SPLIT;
read_replace_refs = 0;
@@ -213,8 +213,10 @@ static int graph_write(int argc, const char **argv)
if (opts.stdin_packs)
pack_indexes = &lines;
- if (opts.stdin_commits)
+ if (opts.stdin_commits) {
commit_hex = &lines;
+ flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
+ }
UNLEAK(buf);
}