From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Matthieu Moy <matthieu.moy@imag.fr>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH try2 6/8] t: branch add publish branch tests
Date: Sat, 12 Oct 2013 02:05:55 -0500 [thread overview]
Message-ID: <1381561561-20459-3-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1381561561-20459-1-git-send-email-felipe.contreras@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
t/t3200-branch.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 44ec6a4..cd0b8e9 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -870,4 +870,80 @@ test_expect_success '--merged catches invalid object names' '
test_must_fail git branch --merged 0000000000000000000000000000000000000000
'
+test_expect_success '--set-publish-to fails on multiple branches' '
+ test_must_fail git branch --set-publish-to master a b c
+'
+
+test_expect_success '--set-publish-to fails on detached HEAD' '
+ test_when_finished "git checkout master" &&
+ git checkout master^{} &&
+ test_must_fail git branch --set-publish-to master
+'
+
+test_expect_success '--set-publish-to fails on a missing dst branch' '
+ test_must_fail git branch --set-publish-to master does-not-exist
+'
+
+test_expect_success '--set-publish-to fails on a missing src branch' '
+ test_must_fail git branch --set-publish-to does-not-exist master
+'
+
+test_expect_success '--set-publish-to fails on a non-ref' '
+ test_must_fail git branch --set-publish-to HEAD^{}
+'
+
+test_expect_success 'use --set-publish-to modify HEAD' '
+ git checkout master &&
+ test_config branch.master.pushremote foo &&
+ test_config branch.master.push foo &&
+ git branch -f test &&
+ git branch --set-publish-to test &&
+ test "$(git config branch.master.pushremote)" = "." &&
+ test "$(git config branch.master.push)" = "refs/heads/test"
+'
+
+test_expect_success 'use --set-publish-to modify a particular branch' '
+ git branch -f test &&
+ git branch -f test2 &&
+ git branch --set-publish-to test2 test &&
+ test "$(git config branch.test.pushremote)" = "." &&
+ test "$(git config branch.test.push)" = "refs/heads/test2"
+'
+
+test_expect_success '--unset-publish should fail if given a non-existent branch' '
+ test_must_fail git branch --unset-publish i-dont-exist
+'
+
+test_expect_success 'test --unset-publish on HEAD' '
+ git checkout master &&
+ git branch -f test &&
+ test_config branch.master.pushremote foo &&
+ test_config branch.master.push foo &&
+ git branch --set-publish-to test &&
+ git branch --unset-publish &&
+ test_must_fail git config branch.master.pushremote &&
+ test_must_fail git config branch.master.push &&
+ # fail for a branch without publish set
+ test_must_fail git branch --unset-publish
+'
+
+test_expect_success '--unset-publish should fail on multiple branches' '
+ test_must_fail git branch --unset-publish a b c
+'
+
+test_expect_success '--unset-publish should fail on detached HEAD' '
+ test_when_finished "git checkout -" &&
+ git checkout HEAD^{} &&
+ test_must_fail git branch --unset-publish
+'
+
+test_expect_success 'test --unset-publish on a particular branch' '
+ git branch -f test &&
+ git branch -f test2 &&
+ git branch --set-publish-to test2 test &&
+ git branch --unset-publish test &&
+ test_must_fail git config branch.test2.pushremote &&
+ test_must_fail git config branch.test2.push
+'
+
test_done
--
1.8.4-fc
next prev parent reply other threads:[~2013-10-12 7:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-12 7:05 [PATCH try2 0/8] Introduce publish tracking branch Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 7/8] push: add --set-publish option Felipe Contreras
2013-10-13 10:03 ` Eric Sunshine
2013-10-13 10:15 ` Felipe Contreras
2013-10-12 7:05 ` Felipe Contreras [this message]
2013-10-12 7:05 ` [PATCH try2 4/8] Add concept of 'publish' branch Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 1/8] branch: trivial cleanup Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 2/8] branch: reorganize verbose options Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 3/8] push: trivial reorganization Felipe Contreras
2013-10-12 7:06 ` [PATCH try2 8/8] branch: display publish branch Felipe Contreras
2013-10-12 7:06 ` [PATCH try2 5/8] branch: allow configuring the " Felipe Contreras
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381561561-20459-3-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=matthieu.moy@imag.fr \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).