summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2018-03-20 10:03:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-29 17:46:48 (GMT)
commit76ea235891c08e43226391cceaca8be056a1f803 (patch)
tree96b2209eb6d010dc8c3bdca2cc6c85f9e67027e2 /sequencer.c
parentbb2ac4fcacaf5044b44e2acb918da33a4cca6af1 (diff)
downloadgit-76ea235891c08e43226391cceaca8be056a1f803.zip
git-76ea235891c08e43226391cceaca8be056a1f803.tar.gz
git-76ea235891c08e43226391cceaca8be056a1f803.tar.bz2
rebase -i --keep-empty: don't prune empty commits
If there are empty commits on the left hand side of $upstream...HEAD then the empty commits on the right hand side that we want to keep are pruned by --cherry-pick. Fix this by using --cherry-mark instead of --cherry-pick and keeping the commits that are empty or are not marked as cherry-picks. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index 4d3f605..1a10766 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2470,7 +2470,7 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,
init_revisions(&revs, NULL);
revs.verbose_header = 1;
revs.max_parents = 1;
- revs.cherry_pick = 1;
+ revs.cherry_mark = 1;
revs.limited = 1;
revs.reverse = 1;
revs.right_only = 1;
@@ -2495,8 +2495,12 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,
return error(_("make_script: error preparing revisions"));
while ((commit = get_revision(&revs))) {
+ int is_empty = is_original_commit_empty(commit);
+
+ if (!is_empty && (commit->object.flags & PATCHSAME))
+ continue;
strbuf_reset(&buf);
- if (!keep_empty && is_original_commit_empty(commit))
+ if (!keep_empty && is_empty)
strbuf_addf(&buf, "%c ", comment_line_char);
strbuf_addf(&buf, "%s %s ", insn,
oid_to_hex(&commit->object.oid));