summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-05-17 15:19:22 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-28 15:32:20 +0200
commitc6e942fb3d10d9f8f2e22833ddddbd945c0d6604 (patch)
treed5257c00aaa122fc73bcd0d9e496c1c63fa36a56 /tests
parentae5b93629c148dc96de7337095fba4b1e901ee2b (diff)
downloadlibgit2-c6e942fb3d10d9f8f2e22833ddddbd945c0d6604.tar.gz
remote: validate refspecs before adding to config
When we moved from acting on the instance to acting on the configuration, we dropped the validation of the passed refspec, which can lead to writing an invalid refspec to the configuration. Bring that validation back.
Diffstat (limited to 'tests')
-rw-r--r--tests/network/remote/remotes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 8619f2e00..2fa21d460 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -128,6 +128,8 @@ void test_network_remote_remotes__add_fetchspec(void)
cl_assert_equal_s(git_refspec_dst(_refspec), "refs/*");
cl_assert_equal_s(git_refspec_string(_refspec), "refs/*:refs/*");
cl_assert_equal_b(_refspec->push, false);
+
+ cl_git_fail_with(GIT_EINVALIDSPEC, git_remote_add_fetch(_repo, "test", "refs/*/foo/*:refs/*"));
}
void test_network_remote_remotes__dup(void)