From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: ps@pks.im
Subject: [PATCH 1/2] rebase: test broken behavior with --keep-empty
Date: Fri, 20 Nov 2015 13:04:39 +0100 [thread overview]
Message-ID: <1448021080-4994-2-git-send-email-ps@pks.im> (raw)
In-Reply-To: <1448021080-4994-1-git-send-email-ps@pks.im>
When a commit is already present in the branch that is being
rebased upon we get an empty commit. Usually we just drop this
commit, but with `--keep-empty` we want to preserve the commit's
message.
Instead of simply applying the empty commit, though, we
erroneously end up in cherry-picking mode without any ability to
get back to the previous rebase.
The same error happens when we try to rebase a commit with
`--keep-empty` that causes a conflict.
Add tests that document this breakage.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t3400-rebase.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 47b5682..6cca319 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -255,4 +255,30 @@ test_expect_success 'rebase commit with an ancient timestamp' '
grep "author .* 34567 +0600$" actual
'
+test_expect_failure 'rebase duplicated commit with --keep-empty' '
+ git reset --hard &&
+ git checkout master &&
+
+ >x && git add x && git commit x -mx &&
+ echo x > x && git commit x -mx1 &&
+
+ git checkout -b duplicated HEAD~ &&
+ echo x > x && git commit x -mx2 &&
+ git rebase --keep-empty master
+'
+
+test_expect_failure 'rebase conflicting commit with --keep-empty' '
+ git reset --hard &&
+ git checkout master &&
+
+ echo y > x && git commit x -my &&
+
+ git checkout -b conflict HEAD~ &&
+ echo z > x && git commit x -mz &&
+ test_must_fail git rebase --keep-empty master &&
+
+ git add x &&
+ git rebase --continue
+'
+
test_done
--
2.6.3
next prev parent reply other threads:[~2015-11-20 12:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 12:04 [PATCH 0/2] rebase: broken behavior with --keep-empty Patrick Steinhardt
2015-11-20 12:04 ` Patrick Steinhardt [this message]
2015-11-20 12:04 ` [PATCH 2/2] rebase: fix preserving commits " Patrick Steinhardt
2015-12-10 22:58 ` Michael Blume
2015-12-14 15:39 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448021080-4994-2-git-send-email-ps@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).