Merge branch 'ew/server-info-remove-crufts'
[gitweb.git] / builtin / rev-list.c
index 877b6561f4aa8f50fd77dfa6a8e5c23dd8708c90..660172b01486f5980e96557c071036eaead3c493 100644 (file)
@@ -77,7 +77,7 @@ static enum missing_action arg_missing_action;
 
 #define DEFAULT_OIDSET_SIZE     (16*1024)
 
-static void finish_commit(struct commit *commit, void *data);
+static void finish_commit(struct commit *commit);
 static void show_commit(struct commit *commit, void *data)
 {
        struct rev_list_info *info = data;
@@ -86,7 +86,7 @@ static void show_commit(struct commit *commit, void *data)
        display_progress(progress, ++progress_counter);
 
        if (info->flags & REV_LIST_QUIET) {
-               finish_commit(commit, data);
+               finish_commit(commit);
                return;
        }
 
@@ -99,7 +99,7 @@ static void show_commit(struct commit *commit, void *data)
                        revs->count_left++;
                else
                        revs->count_right++;
-               finish_commit(commit, data);
+               finish_commit(commit);
                return;
        }
 
@@ -188,16 +188,17 @@ static void show_commit(struct commit *commit, void *data)
                        putchar('\n');
        }
        maybe_flush_or_die(stdout, "stdout");
-       finish_commit(commit, data);
+       finish_commit(commit);
 }
 
-static void finish_commit(struct commit *commit, void *data)
+static void finish_commit(struct commit *commit)
 {
        if (commit->parents) {
                free_commit_list(commit->parents);
                commit->parents = NULL;
        }
-       free_commit_buffer(commit);
+       free_commit_buffer(the_repository->parsed_objects,
+                          commit);
 }
 
 static inline void finish_object__ma(struct object *obj)
@@ -361,6 +362,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 {
        struct rev_info revs;
        struct rev_list_info info;
+       struct setup_revision_opt s_r_opt = {
+               .allow_exclude_promisor_objects = 1,
+       };
        int i;
        int bisect_list = 0;
        int bisect_show_vars = 0;
@@ -372,10 +376,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
                usage(rev_list_usage);
 
        git_config(git_default_config, NULL);
-       init_revisions(&revs, prefix);
+       repo_init_revisions(the_repository, &revs, prefix);
        revs.abbrev = DEFAULT_ABBREV;
        revs.commit_format = CMIT_FMT_UNSPECIFIED;
-       revs.do_not_die_on_missing_tree = 1;
 
        /*
         * Scan the argument list before invoking setup_revisions(), so that we
@@ -405,7 +408,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
                }
        }
 
-       argc = setup_revisions(argc, argv, &revs, NULL);
+       if (arg_missing_action)
+               revs.do_not_die_on_missing_tree = 1;
+
+       argc = setup_revisions(argc, argv, &revs, &s_r_opt);
 
        memset(&info, 0, sizeof(info));
        info.revs = &revs;
@@ -496,7 +502,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
        if ((!revs.commits && reflog_walk_empty(revs.reflog_info) &&
             (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
              !revs.pending.nr) &&
-            !revs.rev_input_given) ||
+            !revs.rev_input_given && !revs.read_from_stdin) ||
            revs.diff)
                usage(rev_list_usage);
 
@@ -542,7 +548,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
        if (prepare_revision_walk(&revs))
                die("revision walk setup failed");
        if (revs.tree_objects)
-               mark_edges_uninteresting(&revs, show_edge);
+               mark_edges_uninteresting(&revs, show_edge, 0);
 
        if (bisect_list) {
                int reaches, all;