Merge branch 'md/exclude-promisor-objects-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 6 Nov 2018 06:50:21 +0000 (15:50 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Nov 2018 06:50:21 +0000 (15:50 +0900)
Operations on promisor objects make sense in the context of only a
small subset of the commands that internally use the revisions
machinery, but the "--exclude-promisor-objects" option were taken
and led to nonsense results by commands like "log", to which it
didn't make much sense. This has been corrected.

* md/exclude-promisor-objects-fix:
exclude-promisor-objects: declare when option is allowed
Documentation/git-log.txt: do not show --exclude-promisor-objects

1  2 
Documentation/rev-list-options.txt
builtin/pack-objects.c
builtin/prune.c
builtin/rev-list.c
revision.c
revision.h
t/t4202-log.sh
Simple merge
index e50c6cd1ff25ce4d65e0ebd854d052c3d1160a2a,8ac8ca1d2609422d603b2a1f8e65027e4e8c0697..c99ee79c31a84a3f67735cb44e85c156f63ad966
@@@ -3105,8 -2851,9 +3105,9 @@@ static void get_object_list(int ac, con
        char line[1000];
        int flags = 0;
  
 -      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);
  
        /* make sure shallows are read */
diff --cc builtin/prune.c
index 1ec9ddd751df6644d2c39ace41a1494800082638,a5c784749eaebd92655800ab87b2df5512501603..e42653b99cffe2f42f2fb853999a41465878ce02
@@@ -118,9 -116,10 +118,10 @@@ 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;
 -      init_revisions(&revs, prefix);
+       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 5064d08e1b8ad04544a76d1f0496134e2c15079c,c8f3ac8d0927e67ea913299bc26173d870d7b29c..2880ed37e3f97193d2374657346b4de52bc44954
@@@ -372,10 -368,10 +372,11 @@@ 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 a1ddb9e11cbe3a52bb8d3eee3785524db4055854,748310c2a3b194322dae8fe586b9a247c186a6b1..28fb2a70cdaaab93e8665a37c2ce02f89a90ed4c
@@@ -2138,9 -2105,10 +2138,10 @@@ static int handle_revision_opt(struct r
                revs->limited = 1;
        } else if (!strcmp(arg, "--ignore-missing")) {
                revs->ignore_missing = 1;
-       } else if (!strcmp(arg, "--exclude-promisor-objects")) {
+       } else if (revs->allow_exclude_promisor_objects_opt &&
+                  !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 1cd0c4b200887e6b73d6a2473712bb5832f7e079,e892a40cd9a0df6e1c184457d69245cb36a711f6..0d2abc2d36ec579c281135a2a3b866fb37911326
@@@ -140,22 -123,8 +140,23 @@@ 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 */
diff --cc t/t4202-log.sh
Simple merge