From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Uwe Kleine-König" <ukleinek@informatik.uni-freiburg.de>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] rebase -i: fix interrupted squashing
Date: Tue, 24 Jul 2007 21:43:09 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707242139370.14781@racer.site> (raw)
In-Reply-To: <20070724200510.GA27610@informatik.uni-freiburg.de>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2701 bytes --]
When a squashing merge failed, the first commit would not be replaced,
due to "git reset --soft" being called with an unmerged index.
Noticed by Uwe Kleine-König.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Tue, 24 Jul 2007, Uwe Kleine-K?nig wrote:
> Johannes Schindelin wrote:
>
> > I'd appreciate if you prepared a patch with better
> > explanations, and also reviewed the man page, if it is in good
> > shape (and does not lie about the current behaviour).
>
> It's on my todo list, but not the top item for git.
Please come around to do it.
> In the mean-time I found another nuisance:
>
> [outlines the test case provided in this patch]
It would have been a bit less work for me, if you would have used
t/trash/ instead of /tmp/, and provided a patch for t3404 for me
to work with.
Alas, the bug was squashed in 5 minutes. It took me 15 minutes to
write (and test) the test.
What a difference order can make...
git-rebase--interactive.sh | 2 +-
t/t3404-rebase-interactive.sh | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 93289c0..78ae51e 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -258,8 +258,8 @@ do_next () {
esac
failed=f
- pick_one -n $sha1 || failed=t
output git reset --soft HEAD^
+ pick_one -n $sha1 || failed=t
author_script=$(get_author_ident_from_commit $sha1)
echo "$author_script" > "$DOTEST"/author-script
case $failed in
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 8206436..817f614 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -221,4 +221,34 @@ test_expect_success 'multi-squash only fires up editor once' '
test 1 = $(git show | grep ONCE | wc -l)
'
+test_expect_success 'squash works as expected' '
+ for n in one two three four
+ do
+ echo $n >> file$n &&
+ git add file$n &&
+ git commit -m $n
+ done &&
+ one=$(git rev-parse HEAD~3) &&
+ FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
+ test $one = $(git rev-parse HEAD~2)
+'
+
+test_expect_success 'interrupted squash works as expected' '
+ for n in one two three four
+ do
+ echo $n >> conflict &&
+ git add conflict &&
+ git commit -m $n
+ done &&
+ one=$(git rev-parse HEAD~3) &&
+ ! FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
+ (echo one; echo two; echo four) > conflict &&
+ git add conflict &&
+ ! git rebase --continue &&
+ echo resolved > conflict &&
+ git add conflict &&
+ git rebase --continue &&
+ test $one = $(git rev-parse HEAD~2)
+'
+
test_done
--
1.5.3.rc2.42.gda8d
next prev parent reply other threads:[~2007-07-24 20:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 22:54 when git-rebase -i fails to cherry-pick Uwe Kleine-König
2007-07-23 23:08 ` Johannes Schindelin
2007-07-24 20:05 ` Uwe Kleine-König
2007-07-24 20:43 ` Johannes Schindelin [this message]
2007-07-27 17:18 ` [PATCH] rebase -i: fix interrupted squashing Johannes Schindelin
2007-07-27 19:20 ` Junio C Hamano
2007-07-27 19:35 ` Johannes Schindelin
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.0707242139370.14781@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ukleinek@informatik.uni-freiburg.de \
/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).