Merge branch 'mz/cherry-pick-cmdline-order'
"git cherry-pick A C B" used to replay changes in A and then B and then C if these three commits had committer timestamps in that order, which is not what the user who said "A C B" naturally expects. * 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
This commit is contained in:
18
revision.c
18
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)
|
||||
|
Reference in New Issue
Block a user