aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-14 21:24:18 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-14 21:24:18 -0700
commit78ed88d80a8cc9e2388ebe7631d71253e1d55aab (patch)
tree060b4e8f75accc932befb149c66bc8e4fa0bd6e5 /revision.c
parentc336bc104c47cc9c2f7caf6bce468fe00a8f6850 (diff)
parenta73e22e96350c9bcb5c0e31e0298ce67bec0a527 (diff)
downloadgit-78ed88d80a8cc9e2388ebe7631d71253e1d55aab.tar.gz
git-78ed88d80a8cc9e2388ebe7631d71253e1d55aab.tar.xz
Merge branch 'mz/cherry-pick-cmdline-order' into maint
* mz/cherry-pick-cmdline-order: cherry-pick/revert: respect order of revisions to pick demonstrate broken 'git cherry-pick three one two' teach log --no-walk=unsorted, which avoids sorting
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/revision.c b/revision.c
index cbcae1086..dc3fecf90 100644
--- a/revision.c
+++ b/revision.c
@@ -1312,7 +1312,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
!strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk") ||
!strcmp(arg, "--bisect") || !prefixcmp(arg, "--glob=") ||
!prefixcmp(arg, "--branches=") || !prefixcmp(arg, "--tags=") ||
- !prefixcmp(arg, "--remotes="))
+ !prefixcmp(arg, "--remotes=") || !prefixcmp(arg, "--no-walk="))
{
unkv[(*unkc)++] = arg;
return 1;
@@ -1707,7 +1707,18 @@ static int handle_revision_pseudo_opt(const char *submodule,
} else if (!strcmp(arg, "--not")) {
*flags ^= UNINTERESTING;
} else if (!strcmp(arg, "--no-walk")) {
- revs->no_walk = 1;
+ revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
+ } else if (!prefixcmp(arg, "--no-walk=")) {
+ /*
+ * Detached form ("--no-walk X" as opposed to "--no-walk=X")
+ * not allowed, since the argument is optional.
+ */
+ if (!strcmp(arg + 10, "sorted"))
+ revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
+ else if (!strcmp(arg + 10, "unsorted"))
+ revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED;
+ else
+ return error("invalid argument to --no-walk");
} else if (!strcmp(arg, "--do-walk")) {
revs->no_walk = 0;
} else {
@@ -2129,10 +2140,11 @@ int prepare_revision_walk(struct rev_info *revs)
}
e++;
}
- commit_list_sort_by_date(&revs->commits);
if (!revs->leak_pending)
free(list);
+ if (revs->no_walk != REVISION_WALK_NO_WALK_UNSORTED)
+ commit_list_sort_by_date(&revs->commits);
if (revs->no_walk)
return 0;
if (revs->limited)