summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-09-02 13:23:54 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-09-02 13:23:54 +0200
commit15c30b72e16528bdf71c0343e4d238600c0df7a1 (patch)
treea27d9413a7bc5e8dc94880a6020c95e3e1f6b4e6 /tests
parente128a1af6ec552f880051b67d72ab0a4c4c7d074 (diff)
downloadlibgit2-cmn/remote-default-restrict.tar.gz
clone: handle overly restrictive refspecscmn/remote-default-restrict
When the fetch refspec does not include the remote's default branch, it indicates an error in user expectations or programmer error. Error out in that case. This lets us get rid of the dummy refspec which can never work as its zeroed out. In the cases where we did not find a default branch, we set HEAD detached immediately, which lets us refactor the "normal" path, removing `found_branch`.
Diffstat (limited to 'tests')
-rw-r--r--tests/network/remote/remotes.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 4e274d889..5fe5143f5 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -556,19 +556,8 @@ void test_network_remote_remotes__restricted_refspecs(void)
{
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
git_repository *repo;
- git_strarray refs;
- size_t i, count = 0;
opts.remote_cb = remote_single_branch;
- cl_git_pass(git_clone(&repo, "git://github.com/libgit2/TestGitRepository", "./restrict-refspec", &opts));
- cl_git_pass(git_reference_list(&refs, repo));
-
- for (i = 0; i < refs.count; i++) {
- if (!git__prefixcmp(refs.strings[i], "refs/heads/"))
- count++;
- }
- cl_assert_equal_i(1, count);
-
- git_repository_free(repo);
+ cl_git_fail_with(GIT_EINVALIDSPEC, git_clone(&repo, "git://github.com/libgit2/TestGitRepository", "./restrict-refspec", &opts));
}