]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/commit-graph.c
Merge branch 'jk/commit-graph-cleanup'
[thirdparty/git.git] / builtin / commit-graph.c
index 38027b83d9d8329a1dc2e47b236a985e4ce71060..052696f1af43c0da6e8ab7f588b451458bec40ce 100644 (file)
@@ -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);
        }
@@ -249,6 +251,8 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix)
                             builtin_commit_graph_usage,
                             PARSE_OPT_STOP_AT_NON_OPTION);
 
+       save_commit_buffer = 0;
+
        if (argc > 0) {
                if (!strcmp(argv[0], "read"))
                        return graph_read(argc, argv);