Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2021-08-05 14:25:24 +0300
committerJunio C Hamano <gitster@pobox.com>2021-08-05 19:37:28 +0300
commit29ef1f27fed21b5b7d3c996a01f1364e7e841917 (patch)
tree731b0e3e1af67217820aef485a8aa2ce95f723ae /revision.c
parente5a14ddd2d93da4d951fd63d4f78fe2410debe68 (diff)
revision: separate walk and unsorted flags
The `--no-walk` flag supports two modes: either it sorts the revisions given as input input or it doesn't. This is reflected in a single `no_walk` flag, which reflects one of the three states "walk", "don't walk but without sorting" and "don't walk but with sorting". Split up the flag into two separate bits, one indicating whether we should walk or not and one indicating whether the input should be sorted or not. This will allow us to more easily introduce a new flag `--unsorted-input`, which only impacts the sorting bit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/revision.c b/revision.c
index cddd0542a6..86bbcd10d2 100644
--- a/revision.c
+++ b/revision.c
@@ -2651,16 +2651,17 @@ static int handle_revision_pseudo_opt(const char *submodule,
} else if (!strcmp(arg, "--not")) {
*flags ^= UNINTERESTING | BOTTOM;
} else if (!strcmp(arg, "--no-walk")) {
- revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
+ revs->no_walk = 1;
} else if (skip_prefix(arg, "--no-walk=", &optarg)) {
/*
* Detached form ("--no-walk X" as opposed to "--no-walk=X")
* not allowed, since the argument is optional.
*/
+ revs->no_walk = 1;
if (!strcmp(optarg, "sorted"))
- revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
+ revs->unsorted_input = 0;
else if (!strcmp(optarg, "unsorted"))
- revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED;
+ revs->unsorted_input = 1;
else
return error("invalid argument to --no-walk");
} else if (!strcmp(arg, "--do-walk")) {
@@ -3584,7 +3585,7 @@ int prepare_revision_walk(struct rev_info *revs)
if (!revs->reflog_info)
prepare_to_use_bloom_filter(revs);
- if (revs->no_walk != REVISION_WALK_NO_WALK_UNSORTED)
+ if (!revs->unsorted_input)
commit_list_sort_by_date(&revs->commits);
if (revs->no_walk)
return 0;