Skip to content

Commit a29b8bc

Browse files
committed
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
2 parents 8ac6990 + 669b1d2 commit a29b8bc

File tree

8 files changed

+15
-2
lines changed

8 files changed

+15
-2
lines changed

Documentation/rev-list-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,14 @@ Unexpected missing objects will raise an error.
761761
+
762762
The form '--missing=print' is like 'allow-any', but will also print a
763763
list of the missing objects. Object IDs are prefixed with a ``?'' character.
764-
endif::git-rev-list[]
765764

766765
--exclude-promisor-objects::
767766
(For internal use only.) Prefilter object traversal at
768767
promisor boundary. This is used with partial clone. This is
769768
stronger than `--missing=allow-promisor` because it limits the
770769
traversal, rather than just silencing errors about missing
771770
objects.
771+
endif::git-rev-list[]
772772

773773
--no-walk[=(sorted|unsorted)]::
774774
Only show the given commits, but do not traverse their ancestors.

builtin/pack-objects.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,6 +3107,7 @@ static void get_object_list(int ac, const char **av)
31073107

31083108
repo_init_revisions(the_repository, &revs, NULL);
31093109
save_commit_buffer = 0;
3110+
revs.allow_exclude_promisor_objects_opt = 1;
31103111
setup_revisions(ac, av, &revs, NULL);
31113112

31123113
/* make sure shallows are read */

builtin/prune.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
120120
save_commit_buffer = 0;
121121
read_replace_refs = 0;
122122
ref_paranoia = 1;
123+
revs.allow_exclude_promisor_objects_opt = 1;
123124
repo_init_revisions(the_repository, &revs, prefix);
124125

125126
argc = parse_options(argc, argv, prefix, options, prune_usage, 0);

builtin/rev-list.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
374374
git_config(git_default_config, NULL);
375375
repo_init_revisions(the_repository, &revs, prefix);
376376
revs.abbrev = DEFAULT_ABBREV;
377+
revs.allow_exclude_promisor_objects_opt = 1;
377378
revs.commit_format = CMIT_FMT_UNSPECIFIED;
378379
revs.do_not_die_on_missing_tree = 1;
379380

revision.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
21382138
revs->limited = 1;
21392139
} else if (!strcmp(arg, "--ignore-missing")) {
21402140
revs->ignore_missing = 1;
2141-
} else if (!strcmp(arg, "--exclude-promisor-objects")) {
2141+
} else if (revs->allow_exclude_promisor_objects_opt &&
2142+
!strcmp(arg, "--exclude-promisor-objects")) {
21422143
if (fetch_if_missing)
21432144
BUG("exclude_promisor_objects can only be used when fetch_if_missing is 0");
21442145
revs->exclude_promisor_objects = 1;

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct rev_info {
156156
do_not_die_on_missing_tree:1,
157157

158158
/* for internal use only */
159+
allow_exclude_promisor_objects_opt:1,
159160
exclude_promisor_objects:1;
160161

161162
/* Diff flags */

t/t4202-log.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,4 +1703,8 @@ test_expect_success 'log --source paints symmetric ranges' '
17031703
test_cmp expect actual
17041704
'
17051705

1706+
test_expect_success '--exclude-promisor-objects does not BUG-crash' '
1707+
test_must_fail git log --exclude-promisor-objects source-a
1708+
'
1709+
17061710
test_done

t/t8002-blame.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,8 @@ test_expect_success '--no-abbrev works like --abbrev=40' '
118118
check_abbrev 40 --no-abbrev
119119
'
120120

121+
test_expect_success '--exclude-promisor-objects does not BUG-crash' '
122+
test_must_fail git blame --exclude-promisor-objects one
123+
'
124+
121125
test_done

0 commit comments

Comments
 (0)