summaryrefslogtreecommitdiff
path: root/tests/online
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-11-07 15:00:11 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-11-09 16:07:43 +0100
commitaad638f3a1e4d98296c2ec9c4ed08f217a652c5c (patch)
tree4276b661b94c788f5aca4c5757846af758bf89d3 /tests/online
parentb4e5432ff032c7d05c82ad2871e27f990493d6b7 (diff)
downloadlibgit2-aad638f3a1e4d98296c2ec9c4ed08f217a652c5c.tar.gz
push: use the common refspec parsercmn/push-refspec-refactor
There is one well-known and well-tested parser which we should use, instead of implementing parsing a second time. The common parser is also augmented to copy the LHS into the RHS if the latter is empty. The expressions test had to change a bit, as we now catch a bad RHS of a refspec locally.
Diffstat (limited to 'tests/online')
-rw-r--r--tests/online/push.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/tests/online/push.c b/tests/online/push.c
index b09c7ad1f..1d4f9bc60 100644
--- a/tests/online/push.c
+++ b/tests/online/push.c
@@ -631,11 +631,11 @@ void test_online_push__multi(void)
void test_online_push__implicit_tgt(void)
{
- const char *specs1[] = { "refs/heads/b1:" };
+ const char *specs1[] = { "refs/heads/b1" };
push_status exp_stats1[] = { { "refs/heads/b1", 1 } };
expected_ref exp_refs1[] = { { "refs/heads/b1", &_oid_b1 } };
- const char *specs2[] = { "refs/heads/b2:" };
+ const char *specs2[] = { "refs/heads/b2" };
push_status exp_stats2[] = { { "refs/heads/b2", 1 } };
expected_ref exp_refs2[] = {
{ "refs/heads/b1", &_oid_b1 },
@@ -838,22 +838,19 @@ void test_online_push__bad_refspecs(void)
void test_online_push__expressions(void)
{
+ git_push *push;
+
/* TODO: Expressions in refspecs doesn't actually work yet */
const char *specs_left_expr[] = { "refs/heads/b2~1:refs/heads/b2" };
- /* expect not NULL to indicate failure (core git replies "funny refname",
- * other servers may be less pithy. */
- const char *specs_right_expr[] = { "refs/heads/b2:refs/heads/b2~1" };
- push_status exp_stats_right_expr[] = { { "refs/heads/b2~1", 0 } };
+ cl_git_pass(git_push_new(&push, _remote));
+ cl_git_fail(git_push_add_refspec(push, "refs/heads/b2:refs/heads/b2~1"));
+ git_push_free(push);
/* TODO: Find a more precise way of checking errors than a exit code of -1. */
do_push(specs_left_expr, ARRAY_SIZE(specs_left_expr),
NULL, 0,
NULL, 0, -1, 0, 0);
-
- do_push(specs_right_expr, ARRAY_SIZE(specs_right_expr),
- exp_stats_right_expr, ARRAY_SIZE(exp_stats_right_expr),
- NULL, 0, 0, 1, 1);
}
void test_online_push__notes(void)