summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-10-08 14:16:43 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-08 14:16:43 +0200
commit457a83a29b40506a81e39205e4a7f6c5f786f452 (patch)
tree477d86bc46c71f7f7a361a942230d2c96ab83682
parent711333efe1c1388c39cd76480273b4fcea18d491 (diff)
downloadlibgit2-cmn/upstream-invalid-refname.tar.gz
branch: add test showing ENOTFOUND for invalid upstream configurationcmn/upstream-invalid-refname
-rw-r--r--tests-clar/refs/branches/upstream.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests-clar/refs/branches/upstream.c b/tests-clar/refs/branches/upstream.c
index 69e55a0c5..04b6ee698 100644
--- a/tests-clar/refs/branches/upstream.c
+++ b/tests-clar/refs/branches/upstream.c
@@ -141,3 +141,26 @@ void test_refs_branches_upstream__set_unset_upstream(void)
git_config_free(config);
cl_git_sandbox_cleanup();
}
+
+void test_refs_branches_upstream__invalid_refname(void)
+{
+ git_reference *branch;
+ git_repository *repository;
+ git_config *config;
+ int ret;
+
+ repository = cl_git_sandbox_init("testrepo.git");
+
+ cl_git_pass(git_repository_config(&config, repository));
+ cl_git_pass(git_config_set_string(config, "branch.test.remote", "test"));
+ cl_git_pass(git_config_set_string(config, "branch.test.merge", "master"));
+
+ /* remote */
+ cl_git_pass(git_reference_lookup(&branch, repository, "refs/heads/test"));
+ ret = git_branch_upstream(&upstream, branch);
+ cl_assert_equal_i(ret, GIT_ENOTFOUND);
+
+ git_reference_free(branch);
+ git_config_free(config);
+ git_repository_free(repository);
+}