]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'md/exclude-promisor-objects-fix-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2019 23:29:31 +0000 (15:29 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2019 23:29:31 +0000 (15:29 -0800)
Code clean-up.

* md/exclude-promisor-objects-fix-cleanup:
  revision.c: put promisor option in specialized struct

builtin/pack-objects.c
builtin/prune.c
builtin/rev-list.c
revision.c
revision.h

index 24bba8147fc96ec2b124aa659c981af08e7a688d..889df2c755176b60fc5c22b0ae553ced23629dc2 100644 (file)
@@ -3084,14 +3084,16 @@ static void record_recent_commit(struct commit *commit, void *data)
 static void get_object_list(int ac, const char **av)
 {
        struct rev_info revs;
+       struct setup_revision_opt s_r_opt = {
+               .allow_exclude_promisor_objects = 1,
+       };
        char line[1000];
        int flags = 0;
        int save_warning;
 
        repo_init_revisions(the_repository, &revs, NULL);
        save_commit_buffer = 0;
-       revs.allow_exclude_promisor_objects_opt = 1;
-       setup_revisions(ac, av, &revs, NULL);
+       setup_revisions(ac, av, &revs, &s_r_opt);
 
        /* make sure shallows are read */
        is_repository_shallow(the_repository);
index e42653b99cffe2f42f2fb853999a41465878ce02..1ec9ddd751df6644d2c39ace41a1494800082638 100644 (file)
@@ -120,7 +120,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
        save_commit_buffer = 0;
        read_replace_refs = 0;
        ref_paranoia = 1;
-       revs.allow_exclude_promisor_objects_opt = 1;
        repo_init_revisions(the_repository, &revs, prefix);
 
        argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
index 2880ed37e3f97193d2374657346b4de52bc44954..51e9e1267e848b345ff7c78fe036e7e66bb6f055 100644 (file)
@@ -361,6 +361,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;
@@ -374,7 +377,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
        git_config(git_default_config, NULL);
        repo_init_revisions(the_repository, &revs, prefix);
        revs.abbrev = DEFAULT_ABBREV;
-       revs.allow_exclude_promisor_objects_opt = 1;
        revs.commit_format = CMIT_FMT_UNSPECIFIED;
        revs.do_not_die_on_missing_tree = 1;
 
@@ -406,7 +408,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
                }
        }
 
-       argc = setup_revisions(argc, argv, &revs, NULL);
+       argc = setup_revisions(argc, argv, &revs, &s_r_opt);
 
        memset(&info, 0, sizeof(info));
        info.revs = &revs;
index f1e6929d4193ad539bda98af2de978abc04ed8bb..8eda04701a7ce1a22fd2bf983955e8a3a4998091 100644 (file)
@@ -1794,7 +1794,8 @@ static void add_message_grep(struct rev_info *revs, const char *pattern)
 }
 
 static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
-                              int *unkc, const char **unkv)
+                              int *unkc, const char **unkv,
+                              const struct setup_revision_opt* opt)
 {
        const char *arg = argv[0];
        const char *optarg;
@@ -2154,7 +2155,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->limited = 1;
        } else if (!strcmp(arg, "--ignore-missing")) {
                revs->ignore_missing = 1;
-       } else if (revs->allow_exclude_promisor_objects_opt &&
+       } else if (opt && opt->allow_exclude_promisor_objects &&
                   !strcmp(arg, "--exclude-promisor-objects")) {
                if (fetch_if_missing)
                        BUG("exclude_promisor_objects can only be used when fetch_if_missing is 0");
@@ -2176,7 +2177,7 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
                        const char * const usagestr[])
 {
        int n = handle_revision_opt(revs, ctx->argc, ctx->argv,
-                                   &ctx->cpidx, ctx->out);
+                                   &ctx->cpidx, ctx->out, NULL);
        if (n <= 0) {
                error("unknown option `%s'", ctx->argv[0]);
                usage_with_options(usagestr, options);
@@ -2394,7 +2395,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
                                continue;
                        }
 
-                       opts = handle_revision_opt(revs, argc - i, argv + i, &left, argv);
+                       opts = handle_revision_opt(revs, argc - i, argv + i,
+                                                  &left, argv, opt);
                        if (opts > 0) {
                                i += opts - 1;
                                continue;
index 7987bfcd2e9bd6ee7bac4f1cbeb10af17ab40b50..52e5a88ff5725862dced5c72fbc2aa6435b94e3b 100644 (file)
@@ -161,7 +161,6 @@ struct rev_info {
                        do_not_die_on_missing_tree:1,
 
                        /* for internal use only */
-                       allow_exclude_promisor_objects_opt:1,
                        exclude_promisor_objects:1;
 
        /* Diff flags */
@@ -297,7 +296,8 @@ struct setup_revision_opt {
        const char *def;
        void (*tweak)(struct rev_info *, struct setup_revision_opt *);
        const char *submodule;  /* TODO: drop this and use rev_info->repo */
-       int assume_dashdash;
+       unsigned int    assume_dashdash:1,
+                       allow_exclude_promisor_objects:1;
        unsigned revarg_opt;
 };