Revert "connected: do not sort input revisions"

This reverts commit f45022dc2fd692fd024f2eb41a86a66f19013d43, as this is like breakage in the traversal more likely. In a history with 10 single strand of pearls, 1-->2-->3--...->7-->8-->9-->10 asking "rev-list --unsorted-input 1 10 --not 9 8 7 6 5 4" fails to paint the bottom 1 uninteresting as the traversal stops, without completing the propagation of uninteresting bit starting at 4 down through 3 and 2 to 1.

Junio C Hamano committed Nov 11, 2021 at 12:34 UTC a7df4f52affe49f6b06246b9398e99e1937f9efc
4 files changed +1 -48
Documentation/rev-list-options.txt
+1 -7
@@ -968,11 +968,6 @@ list of the missing objects. Object IDs are prefixed with a ``?'' character.
968 objects.
969 endif::git-rev-list[]
970
971 ---unsorted-input::
972 - Show commits in the order they were given on the command line instead
973 - of sorting them in reverse chronological order by commit time. Cannot
974 - be combined with `--no-walk` or `--no-walk=sorted`.
975 -
971 --no-walk[=(sorted|unsorted)]::
972 Only show the given commits, but do not traverse their ancestors.
973 This has no effect if a range is specified. If the argument
@@ -980,8 +975,7 @@ endif::git-rev-list[]
975 given on the command line. Otherwise (if `sorted` or no argument
976 was given), the commits are shown in reverse chronological order
977 by commit time.
983 - Cannot be combined with `--graph`. Cannot be combined with
984 - `--unsorted-input` if `sorted` or no argument was given.
978 + Cannot be combined with `--graph`.
979
980 --do-walk::
981 Overrides a previous `--no-walk`.
connected.c
-1
@@ -106,7 +106,6 @@ no_promisor_pack_found:
106 if (opt->progress)
107 strvec_pushf(&rev_list.args, "--progress=%s",
108 _("Checking connectivity"));
109 - strvec_push(&rev_list.args, "--unsorted-input");
109
110 rev_list.git_cmd = 1;
111 rev_list.env = opt->env;
revision.c
-9
@@ -2254,10 +2254,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
2254 } else if (!strcmp(arg, "--author-date-order")) {
2255 revs->sort_order = REV_SORT_BY_AUTHOR_DATE;
2256 revs->topo_order = 1;
2257 - } else if (!strcmp(arg, "--unsorted-input")) {
2258 - if (revs->no_walk)
2259 - die(_("--unsorted-input is incompatible with --no-walk"));
2260 - revs->unsorted_input = 1;
2257 } else if (!strcmp(arg, "--early-output")) {
2258 revs->early_output = 100;
2259 revs->topo_order = 1;
@@ -2653,13 +2649,8 @@ static int handle_revision_pseudo_opt(const char *submodule,
2649 } else if (!strcmp(arg, "--not")) {
2650 *flags ^= UNINTERESTING | BOTTOM;
2651 } else if (!strcmp(arg, "--no-walk")) {
2656 - if (!revs->no_walk && revs->unsorted_input)
2657 - die(_("--no-walk is incompatible with --unsorted-input"));
2652 revs->no_walk = 1;
2653 } else if (skip_prefix(arg, "--no-walk=", &optarg)) {
2660 - if (!revs->no_walk && revs->unsorted_input)
2661 - die(_("--no-walk is incompatible with --unsorted-input"));
2662 -
2654 /*
2655 * Detached form ("--no-walk X" as opposed to "--no-walk=X")
2656 * not allowed, since the argument is optional.
t/t6000-rev-list-misc.sh
-31
@@ -169,35 +169,4 @@ test_expect_success 'rev-list --count --objects' '
169 test_line_count = $count actual
170 '
171
172 -test_expect_success 'rev-list --unsorted-input results in different sorting' '
173 - git rev-list --unsorted-input HEAD HEAD~ >first &&
174 - git rev-list --unsorted-input HEAD~ HEAD >second &&
175 - ! test_cmp first second &&
176 - sort first >first.sorted &&
177 - sort second >second.sorted &&
178 - test_cmp first.sorted second.sorted
179 -'
180 -
181 -test_expect_success 'rev-list --unsorted-input incompatible with --no-walk' '
182 - cat >expect <<-EOF &&
183 - fatal: --no-walk is incompatible with --unsorted-input
184 - EOF
185 - test_must_fail git rev-list --unsorted-input --no-walk HEAD 2>error &&
186 - test_cmp expect error &&
187 - test_must_fail git rev-list --unsorted-input --no-walk=sorted HEAD 2>error &&
188 - test_cmp expect error &&
189 - test_must_fail git rev-list --unsorted-input --no-walk=unsorted HEAD 2>error &&
190 - test_cmp expect error &&
191 -
192 - cat >expect <<-EOF &&
193 - fatal: --unsorted-input is incompatible with --no-walk
194 - EOF
195 - test_must_fail git rev-list --no-walk --unsorted-input HEAD 2>error &&
196 - test_cmp expect error &&
197 - test_must_fail git rev-list --no-walk=sorted --unsorted-input HEAD 2>error &&
198 - test_cmp expect error &&
199 - test_must_fail git rev-list --no-walk=unsorted --unsorted-input HEAD 2>error &&
200 - test_cmp expect error
201 -'
202 -
172 test_done