From: David Greene <greened@obbligato.org>
To: git@vger.kernel.org
Cc: techlivezheng@gmail.com, alex.crezoff@gmail.com,
davvid@gmail.com, cbailey32@bloomberg.net, danny0838@gmail.com,
prohaska@zib.de, th.acker@arcor.de, sschuberth@gmail.com,
peff@peff.net, gitter.spiros@gmail.com, nod.helm@gmail.com,
"David A . Greene" <greened@obbligato.org>
Subject: [PATCH 3/7] contrib/subtree: Add tests for subtree add
Date: Thu, 5 Nov 2015 21:34:59 -0600 [thread overview]
Message-ID: <1446780903-22156-4-git-send-email-greened@obbligato.org> (raw)
In-Reply-To: <1446780903-22156-1-git-send-email-greened@obbligato.org>
From: Techlive Zheng <techlivezheng@gmail.com>
Add some tests to check various options to subtree add. These test
various combinations of --message, --prefix and --squash.
Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>
Signed-off-by: David A. Greene <greened@obbligato.org>
---
contrib/subtree/t/t7900-subtree.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 4471786..1fa5991 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -127,12 +127,24 @@ test_expect_success 'no merge from non-existent subtree' '
test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
'
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
+ git subtree add --prefix="sub dir" sub1 &&
+ check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit '\''$(git rev-parse sub1)'\''" &&
+ undo
+'
+
test_expect_success 'check if --message works for add' '
git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
check_equal ''"$(last_commit_message)"'' "Added subproject" &&
undo
'
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix and --message' '
+ git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
+ check_equal "$(last_commit_message)" "Added subproject" &&
+ undo
+'
+
test_expect_success 'check if --message works as -m and --prefix as -P' '
git subtree add -P "sub dir" -m "Added subproject using git subtree" sub1 &&
check_equal ''"$(last_commit_message)"'' "Added subproject using git subtree" &&
@@ -145,6 +157,13 @@ test_expect_success 'check if --message works with squash too' '
undo
'
+test_expect_success 'add subproj as subtree into sub dir/ with --squash and --prefix and --message' '
+ git subtree add --prefix="sub dir" --message="Added subproject with squash" --squash sub1 &&
+ check_equal "$(last_commit_message)" "Added subproject with squash" &&
+ undo
+'
+
+# Maybe delete
test_expect_success 'add subproj to mainline' '
git subtree add --prefix="sub dir"/ FETCH_HEAD &&
check_equal ''"$(last_commit_message)"'' "Add '"'sub dir/'"' from commit '"'"'''"$(git rev-parse sub1)"'''"'"'"
--
2.6.1
next prev parent reply other threads:[~2015-11-06 4:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 3:34 (unknown), David Greene
2015-11-06 3:34 ` [PATCH 1/7] contrib/subtree: Clean and refactor test code David Greene
2015-11-11 2:52 ` David A. Greene
2015-11-06 3:34 ` [PATCH 2/7] contrib/subtree: Add test for missing subtree David Greene
2015-11-06 3:34 ` David Greene [this message]
2015-11-06 3:35 ` [PATCH 4/7] contrib/subtree: Add merge tests David Greene
2015-11-06 3:35 ` [PATCH 5/7] contrib/subtree: Add split tests David Greene
2015-11-06 3:35 ` [PATCH 6/7] contrib/subtree: Make each test self-contained David Greene
2015-11-06 3:35 ` [PATCH 7/7] contrib/subtree: Handle '--prefix' argument with a slash appended David Greene
-- strict thread matches above, loose matches on Subject: below --
2015-11-13 2:32 [PATCH 0/7] contrib/subtree: Testsuite cleanup David Greene
2015-11-13 2:32 ` [PATCH 3/7] contrib/subtree: Add tests for subtree add David Greene
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=1446780903-22156-4-git-send-email-greened@obbligato.org \
--to=greened@obbligato.org \
--cc=alex.crezoff@gmail.com \
--cc=cbailey32@bloomberg.net \
--cc=danny0838@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitter.spiros@gmail.com \
--cc=nod.helm@gmail.com \
--cc=peff@peff.net \
--cc=prohaska@zib.de \
--cc=sschuberth@gmail.com \
--cc=techlivezheng@gmail.com \
--cc=th.acker@arcor.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.