diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2020-04-11 02:44:27 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-11 14:15:57 -0700 |
commit | 0fcb4f6b62c87a73971890070dea847b56176338 (patch) | |
tree | 2856bf93aa397f1bb20a98129a2bc99ea2a315cb /sequencer.c | |
parent | rebase: fix an incompatible-options error message (diff) | |
download | tgif-0fcb4f6b62c87a73971890070dea847b56176338.tar.xz |
rebase --merge: optionally skip upstreamed commits
When rebasing against an upstream that has had many commits since the
original branch was created:
O -- O -- ... -- O -- O (upstream)
\
-- O (my-dev-branch)
it must read the contents of every novel upstream commit, in addition to
the tip of the upstream and the merge base, because "git rebase"
attempts to exclude commits that are duplicates of upstream ones. This
can be a significant performance hit, especially in a partial clone,
wherein a read of an object may end up being a fetch.
Add a flag to "git rebase" to allow suppression of this feature. This
flag only works when using the "merge" backend.
This flag changes the behavior of sequencer_make_script(), called from
do_interactive_rebase() <- run_rebase_interactive() <-
run_specific_rebase() <- cmd_rebase(). With this flag, limit_list()
(indirectly called from sequencer_make_script() through
prepare_revision_walk()) will no longer call cherry_pick_list(), and
thus PATCHSAME is no longer set. Refraining from setting PATCHSAME both
means that the intermediate commits in upstream are no longer read (as
shown by the test) and means that no PATCHSAME-caused skipping of
commits is done by sequencer_make_script(), either directly or through
make_script_with_merges().
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c index d973e19729..667648d6f9 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4828,12 +4828,13 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc, int keep_empty = flags & TODO_LIST_KEEP_EMPTY; const char *insn = flags & TODO_LIST_ABBREVIATE_CMDS ? "p" : "pick"; int rebase_merges = flags & TODO_LIST_REBASE_MERGES; + int reapply_cherry_picks = flags & TODO_LIST_REAPPLY_CHERRY_PICKS; repo_init_revisions(r, &revs, NULL); revs.verbose_header = 1; if (!rebase_merges) revs.max_parents = 1; - revs.cherry_mark = 1; + revs.cherry_mark = !reapply_cherry_picks; revs.limited = 1; revs.reverse = 1; revs.right_only = 1; |