From: Junio C Hamano Date: Tue, 6 Nov 2018 06:50:21 +0000 (+0900) Subject: Merge branch 'md/exclude-promisor-objects-fix' X-Git-Tag: v2.20.0-rc0~67 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgit.git;a=commitdiff_plain;h=a29b8bcf624006cf66abe129c01c932ec75df9f7 Merge branch 'md/exclude-promisor-objects-fix' 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 --- a29b8bcf624006cf66abe129c01c932ec75df9f7 diff --cc builtin/pack-objects.c index e50c6cd1ff,8ac8ca1d26..c99ee79c31 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@@ -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 1ec9ddd751,a5c784749e..e42653b99c --- a/builtin/prune.c +++ b/builtin/prune.c @@@ -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; + 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); diff --cc builtin/rev-list.c index 5064d08e1b,c8f3ac8d09..2880ed37e3 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@@ -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 a1ddb9e11c,748310c2a3..28fb2a70cd --- a/revision.c +++ b/revision.c @@@ -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 1cd0c4b200,e892a40cd9..0d2abc2d36 --- a/revision.h +++ b/revision.h @@@ -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 */