From: Chris Webb <chris@arachsys.com>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
Chris Webb <chris@arachsys.com>
Subject: [PATCH 2/2] Add tests for rebase -i --root without --onto
Date: Tue, 26 Jun 2012 14:36:33 +0100 [thread overview]
Message-ID: <a00f5d0e6ae7e2d07a26b506788ef1270af57558.1340717793.git.chris@arachsys.com> (raw)
In-Reply-To: <20120626133339.GT9682@arachsys.com>
In-Reply-To: <bdb45972685db8899a46ebc62213e56c9a3d0c94.1340717793.git.chris@arachsys.com>
Test for likely breakages in t3404, including successful reordering of
non-conflicting changes with a new root, correct preservation of commit
message and author in a root commit when it is squashed with the
sentinel, and presence of the sentinel following a conflicting
cherry-pick of a new root.
Remove test_must_fail for git rebase --root without --onto from t3412 as
this case will now be successfully handled by an implicit git rebase -i.
Signed-off-by: Chris Webb <chris@arachsys.com>
---
t/t3404-rebase-interactive.sh | 27 +++++++++++++++++++++++++++
t/t3412-rebase-root.sh | 4 ----
2 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 025c1c6..6ffc9c2 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -755,4 +755,31 @@ test_expect_success 'rebase-i history with funny messages' '
test_cmp expect actual
'
+test_expect_success 'rebase -i --root re-order and drop commits' '
+ git checkout E &&
+ FAKE_LINES="3 1 2 5" git rebase -i --root &&
+ test E = $(git cat-file commit HEAD | sed -ne \$p) &&
+ test B = $(git cat-file commit HEAD^ | sed -ne \$p) &&
+ test A = $(git cat-file commit HEAD^^ | sed -ne \$p) &&
+ test C = $(git cat-file commit HEAD^^^ | sed -ne \$p) &&
+ test 0 = $(git cat-file commit HEAD^^^ | grep -c ^parent\ )
+'
+
+test_expect_success 'rebase -i --root retain root commit author and message' '
+ git checkout A &&
+ echo B >file7 &&
+ git add file7 &&
+ GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" &&
+ FAKE_LINES="2" git rebase -i --root &&
+ git cat-file commit HEAD | grep -q "^author Twerp Snog" &&
+ git cat-file commit HEAD | grep -q "^different author$"
+'
+
+test_expect_success 'rebase -i --root temporary sentinel commit' '
+ git checkout B &&
+ FAKE_LINES="2" test_must_fail git rebase -i --root &&
+ git cat-file commit HEAD | grep "^tree 4b825dc642cb" &&
+ git rebase --abort
+'
+
test_done
diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh
index 086c91c..e4f9da8 100755
--- a/t/t3412-rebase-root.sh
+++ b/t/t3412-rebase-root.sh
@@ -22,10 +22,6 @@ test_expect_success 'prepare repository' '
test_commit 4 B
'
-test_expect_success 'rebase --root expects --onto' '
- test_must_fail git rebase --root
-'
-
test_expect_success 'setup pre-rebase hook' '
mkdir -p .git/hooks &&
cat >.git/hooks/pre-rebase <<EOF &&
--
1.7.10
next prev parent reply other threads:[~2012-06-26 13:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 9:16 Editing the root commit Chris Webb
2012-06-19 10:09 ` Junio C Hamano
2012-06-19 11:17 ` Chris Webb
2012-06-20 9:32 ` Chris Webb
2012-06-20 18:25 ` Junio C Hamano
2012-06-20 19:29 ` Jeff King
2012-06-20 19:39 ` Chris Webb
2012-06-20 19:48 ` Jeff King
2012-06-22 20:50 ` Chris Webb
2012-06-22 21:35 ` Junio C Hamano
2012-06-22 22:02 ` Chris Webb
2012-06-22 22:26 ` Chris Webb
2012-06-22 22:50 ` Junio C Hamano
2012-06-23 7:20 ` Chris Webb
2012-06-26 15:04 ` git-commit bug (was Re: Editing the root commit) Chris Webb
2012-06-26 15:06 ` [PATCH] git-checkout: disallow --detach on unborn branch Chris Webb
2012-06-26 18:08 ` git-commit bug Junio C Hamano
2012-06-26 13:33 ` Editing the root commit Chris Webb
2012-06-26 13:36 ` [PATCH 1/2] rebase -i: support --root without --onto Chris Webb
2012-06-26 13:36 ` Chris Webb [this message]
2012-06-26 19:20 ` Junio C Hamano
2012-06-26 19:38 ` Chris Webb
2012-06-26 20:05 ` Junio C Hamano
2012-06-26 20:11 ` Chris Webb
2012-06-26 21:24 ` Junio C Hamano
2012-06-26 21:27 ` Chris Webb
2012-06-20 19:35 ` Editing the root commit Chris Webb
2012-06-25 17:22 ` Martin von Zweigbergk
2012-06-19 11:50 ` jaseem abid
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=a00f5d0e6ae7e2d07a26b506788ef1270af57558.1340717793.git.chris@arachsys.com \
--to=chris@arachsys.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).