diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-08-22 22:34:11 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-08-22 22:34:11 +0300 |
commit | 6ba06b582bcf0fb4afa9fcc7d265005eb20cd50f (patch) | |
tree | 691eb351631f68e5e72707ac27197041b7775e34 /builtin | |
parent | 072735ea58407db41c0874fd2f8a91d0c191d49b (diff) | |
parent | 7c5c9b9c57d58273d17dfc3fec3ebdb25077a9de (diff) |
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')
-rw-r--r-- | builtin/commit-graph.c | 10 | ||||
-rw-r--r-- | builtin/gc.c | 2 |
2 files changed, 7 insertions, 5 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); } diff --git a/builtin/gc.c b/builtin/gc.c index c18efadda5..305fb0f45a 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -687,7 +687,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) if (gc_write_commit_graph && write_commit_graph_reachable(get_object_directory(), - !quiet && !daemonized ? COMMIT_GRAPH_PROGRESS : 0, + !quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0, NULL)) return 1; |