From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] Add test for git rebase --abort
Date: Fri, 29 Feb 2008 23:08:47 +0100 [thread overview]
Message-ID: <1204322927-22407-1-git-send-email-mh@glandium.org> (raw)
We expect git rebase --abort to come back to the original (pre-rebase)
head, independently from when it's run during a rebase.
Signed-off-by: Mike Hommey <mh@glandium.org>
---
I wrote this test because I spotted a problem with git rebase --abort, and
expanded the test to other cases that work, but that it is still better to
have a test for.
The failing test is the third. I don't have enough knowledge in git-rebase
to write an appropriate fix, but the problem seems to be in
move_to_original_branch, where testing head_name doesn't seem appropriate.
t/t3407-rebase-abort.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
create mode 100755 t/t3407-rebase-abort.sh
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
new file mode 100755
index 0000000..abdecc9
--- /dev/null
+++ b/t/t3407-rebase-abort.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='git rebase --abort tests'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo a > a &&
+ git add a &&
+ git commit -m a &&
+ git branch to-rebase &&
+
+ echo b > a &&
+ git commit -a -m b &&
+ echo c > a &&
+ git commit -a -m c &&
+
+ git checkout to-rebase &&
+ echo d > a &&
+ git commit -a -m "merge should fail on this" &&
+ echo e > a &&
+ git commit -a -m "merge should fail on this, too" &&
+ git branch pre-rebase
+'
+
+test_expect_success 'rebase --abort' '
+ ! git rebase master &&
+ git rebase --abort &&
+ test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
+'
+
+# In case previous test failed
+git reset --hard pre-rebase >&3 2>&4
+rm -rf .dotest # Should be changed whenever rebase stop using .dotest
+
+test_expect_success 'rebase --abort after --skip' '
+ ! git rebase master &&
+ ! git rebase --skip &&
+ test $(git rev-parse HEAD) = $(git rev-parse master) &&
+ sh -x ../../git-rebase --abort &&
+ test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
+'
+
+# In case previous test failed
+git reset --hard pre-rebase >&3 2>&4
+rm -rf .dotest # Should be changed whenever rebase stop using .dotest
+
+test_expect_success 'rebase --abort after --continue' '
+ ! git rebase master &&
+ echo c > a &&
+ echo d >> a &&
+ git add a &&
+ ! git rebase --continue &&
+ test $(git rev-parse HEAD) != $(git rev-parse master) &&
+ git rebase --abort &&
+ test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
+'
+
+test_done
--
1.5.4.3.340.g97b97.dirty
next reply other threads:[~2008-02-29 22:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 22:08 Mike Hommey [this message]
2008-02-29 23:26 ` [PATCH] Add test for git rebase --abort Junio C Hamano
2008-02-29 23:39 ` Johannes Schindelin
2008-03-01 7:36 ` Mike Hommey
2008-03-01 7:41 ` Junio C Hamano
2008-03-01 7:45 ` Mike Hommey
2008-03-01 8:15 ` Mike Hommey
2008-03-01 9:17 ` Junio C Hamano
2008-03-01 10:32 ` [PATCH] Fix git reset --abort not restoring the right commit under some conditions Mike Hommey
2008-03-01 11:11 ` Mike Hommey
2008-03-02 2:27 ` Junio C Hamano
2008-03-02 3:57 ` 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=1204322927-22407-1-git-send-email-mh@glandium.org \
--to=mh@glandium.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).