]> 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

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

index 24bba8147fc96ec2b124aa659c981af08e7a688d,4408807e62de8cc0721e2a567d98ded042a0087d..889df2c755176b60fc5c22b0ae553ced23629dc2
@@@ -3084,20 -2848,18 +3084,22 @@@ static void record_recent_commit(struc
  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;
  
 -      init_revisions(&revs, NULL);
 +      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();
 +      is_repository_shallow(the_repository);
 +
 +      save_warning = warn_on_object_refname_ambiguity;
 +      warn_on_object_refname_ambiguity = 0;
  
        while (fgets(line, sizeof(line), stdin) != NULL) {
                int len = strlen(line);
diff --cc builtin/prune.c
index e42653b99cffe2f42f2fb853999a41465878ce02,4394d01c9350ae3e1fa26de034edf1509128469e..1ec9ddd751df6644d2c39ace41a1494800082638
@@@ -118,10 -116,9 +118,9 @@@ int cmd_prune(int argc, const char **ar
  
        expire = TIME_MAX;
        save_commit_buffer = 0;
 -      check_replace_refs = 0;
 +      read_replace_refs = 0;
        ref_paranoia = 1;
-       revs.allow_exclude_promisor_objects_opt = 1;
 -      init_revisions(&revs, prefix);
 +      repo_init_revisions(the_repository, &revs, prefix);
  
        argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
  
index 2880ed37e3f97193d2374657346b4de52bc44954,807a50a2fb3f59d8dbd67378b1a4336f0a21aa25..51e9e1267e848b345ff7c78fe036e7e66bb6f055
@@@ -372,11 -371,9 +375,10 @@@ int cmd_rev_list(int argc, const char *
                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.allow_exclude_promisor_objects_opt = 1;
        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
diff --cc revision.c
index f1e6929d4193ad539bda98af2de978abc04ed8bb,f19de0de34f66aecc3d09108942607c40b7d66ef..8eda04701a7ce1a22fd2bf983955e8a3a4998091
@@@ -2154,10 -2106,10 +2155,10 @@@ static int handle_revision_opt(struct r
                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)
 -                      die("BUG: exclude_promisor_objects can only be used when fetch_if_missing is 0");
 +                      BUG("exclude_promisor_objects can only be used when fetch_if_missing is 0");
                revs->exclude_promisor_objects = 1;
        } else {
                int opts = diff_opt_parse(&revs->diffopt, argv, argc, revs->prefix);
diff --cc revision.h
index 7987bfcd2e9bd6ee7bac4f1cbeb10af17ab40b50,8b81ae334233bf10cf2b25ccf2e4f7e22afa2560..52e5a88ff5725862dced5c72fbc2aa6435b94e3b
@@@ -145,23 -123,7 +145,22 @@@ struct rev_info 
                        line_level_traverse:1,
                        tree_blobs_in_commit_order:1,
  
 +                      /*
 +                       * Blobs are shown without regard for their existence.
 +                       * But not so for trees: unless exclude_promisor_objects
 +                       * is set and the tree in question is a promisor object;
 +                       * OR ignore_missing_links is set, the revision walker
 +                       * dies with a "bad tree object HASH" message when
 +                       * encountering a missing tree. For callers that can
 +                       * handle missing trees and want them to be filterable
 +                       * and showable, set this to true. The revision walker
 +                       * will filter and show such a missing tree as usual,
 +                       * but will not attempt to recurse into this tree
 +                       * object.
 +                       */
 +                      do_not_die_on_missing_tree:1,
 +
                        /* for internal use only */
-                       allow_exclude_promisor_objects_opt:1,
                        exclude_promisor_objects:1;
  
        /* Diff flags */
@@@ -296,8 -243,9 +295,9 @@@ extern volatile show_early_output_fn_t 
  struct setup_revision_opt {
        const char *def;
        void (*tweak)(struct rev_info *, struct setup_revision_opt *);
 -      const char *submodule;
 +      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;
  };