From: Junio C Hamano Date: Mon, 14 Jan 2019 23:29:31 +0000 (-0800) Subject: Merge branch 'md/exclude-promisor-objects-fix-cleanup' X-Git-Tag: v2.21.0-rc0~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e5be1f2d5bac42c28a126d382bf7b7bdcb9b7f3;p=git Merge branch 'md/exclude-promisor-objects-fix-cleanup' Code clean-up. * md/exclude-promisor-objects-fix-cleanup: revision.c: put promisor option in specialized struct --- 6e5be1f2d5bac42c28a126d382bf7b7bdcb9b7f3 diff --cc builtin/pack-objects.c index 24bba8147f,4408807e62..889df2c755 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@@ -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 e42653b99c,4394d01c93..1ec9ddd751 --- a/builtin/prune.c +++ b/builtin/prune.c @@@ -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); diff --cc builtin/rev-list.c index 2880ed37e3,807a50a2fb..51e9e1267e --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@@ -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 f1e6929d41,f19de0de34..8eda04701a --- a/revision.c +++ b/revision.c @@@ -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 7987bfcd2e,8b81ae3342..52e5a88ff5 --- a/revision.h +++ b/revision.h @@@ -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; };