Re: [BUG] multi-commit cherry-pick messes up the order of commits
From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:47
Subsystem:
the rest · Maintainer:
Linus Torvalds
Hi Peff, Jeff King wrote:
I agree it would be nice to make: git cherry-pick commit1 commit3 commit2 work in the order specified, but how does that interact with existing cases that provide more traditional revision arguments?
What are your thoughts on making it a flag in the revision API to be activated with "cherry-pick --literal-order commit1 commit3 commit2" or similar? I'm not sure how to get it to reconcile with the more traditional revision arguments yet. My current worktree (WIP):
diff --git a/builtin/revert.c b/builtin/revert.c
index 0d8020c..47da41b 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c@@ -228,6 +228,7 @@ static void parse_args(int argc, const char**argv, struct re
opts->revs = xmalloc(sizeof(*opts->revs));
init_revisions(opts->revs, NULL);
opts->revs->no_walk = 1;
+ opts->revs->literal_order = 1;
if (argc < 2)
usage_with_options(usage_str, options);
argc = setup_revisions(argc, argv, opts->revs, NULL);diff --git a/revision.c b/revision.c
index 064e351..301ef58 100644
--- a/revision.c
+++ b/revision.c@@ -2054,7 +2054,10 @@ int prepare_revision_walk(struct rev_info *revs) if (commit) { if (!(commit->object.flags & SEEN)) { commit->object.flags |= SEEN; - commit_list_insert_by_date(commit,
&revs->commits
+ if (revs->literal_order)
+ commit_list_insert(commit,
&revs->commits
+ else
+
commit_list_insert_by_date(commit, &revs-
}
}
e++;diff --git a/revision.h b/revision.h
index b8e9223..65c3dc3 100644
--- a/revision.h
+++ b/revision.h@@ -67,6 +67,7 @@ struct rev_info { remove_empty_trees:1, simplify_history:1, lifo:1, + literal_order:1, topo_order:1, simplify_merges:1, simplify_by_decoration:1,