From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Pieter de Bie <pdebie@ai.rug.nl>,
Johannes Sixt <j.sixt@viscovery.net>,
git@vger.kernel.org
Subject: [PATCH w/ test] rebase -p -i: handle "no changes" gracefully
Date: Mon, 17 Dec 2007 21:01:25 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0712172100450.9446@racer.site> (raw)
In-Reply-To: <7vprx56pfn.fsf@gitster.siamese.dyndns.org>
Since commit 376ccb8cbb453343998e734d8a1ce79f57a4e092, unchanged
SHA-1s are no longer mapped via $REWRITTEN. But the updating
phase was not prepared for the old head not being rewritten.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Mon, 17 Dec 2007, Junio C Hamano wrote:
> Hmph, care to add a test to t3404?
How about this?
git-rebase--interactive.sh | 7 ++++++-
t/t3404-rebase-interactive.sh | 6 ++++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index f83e00f..cd7e43f 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -322,7 +322,12 @@ do_next () {
test -f "$DOTEST"/current-commit &&
current_commit=$(cat "$DOTEST"/current-commit) &&
git rev-parse HEAD > "$REWRITTEN"/$current_commit
- NEWHEAD=$(cat "$REWRITTEN"/$OLDHEAD)
+ if test -f "$REWRITTEN"/$OLDHEAD
+ then
+ NEWHEAD=$(cat "$REWRITTEN"/$OLDHEAD)
+ else
+ NEWHEAD=$OLDHEAD
+ fi
else
NEWHEAD=$(git rev-parse HEAD)
fi &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 907c7f9..74a7eb3 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -184,6 +184,12 @@ test_expect_success 'retain authorship when squashing' '
git show HEAD | grep "^Author: Twerp Snog"
'
+test_expect_success '-p handles "no changes" gracefully' '
+ HEAD=$(git rev-parse HEAD) &&
+ git rebase -i -p HEAD^ &&
+ test $HEAD = $(git rev-parse HEAD)
+'
+
test_expect_success 'preserve merges with -p' '
git checkout -b to-be-preserved master^ &&
: > unrelated-file &&
--
1.5.4.rc0.59.g1d10d
next prev parent reply other threads:[~2007-12-17 21:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 1:21 [BUG?] git rebase -i Pieter de Bie
2007-12-14 7:30 ` Johannes Sixt
2007-12-17 16:04 ` Pieter de Bie
2007-12-17 16:59 ` [PATCH] rebase -p -i: handle "no changes" gracefully Johannes Schindelin
2007-12-17 20:23 ` Junio C Hamano
2007-12-17 21:01 ` Johannes Schindelin [this message]
2007-12-18 20:24 ` [PATCH w/ test] " Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0712172100450.9446@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=pdebie@ai.rug.nl \
/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.
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 NNTP newsgroup(s).