Skip to content

Commit 55f2abb

Browse files
committed
tests: upstream merge test has been added.
1 parent 9457190 commit 55f2abb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/refs/branches/upstream.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ void test_refs_branches_upstream__upstream_remote(void)
7171
git_buf_dispose(&buf);
7272
}
7373

74+
void test_refs_branches_upstream__upstream_merge(void)
75+
{
76+
git_reference *branch;
77+
git_repository *repository;
78+
git_buf buf = GIT_BUF_INIT;
79+
80+
repository = cl_git_sandbox_init("testrepo.git");
81+
82+
/* check repository */
83+
cl_git_pass(git_reference_lookup(&branch, repository, "refs/heads/test"));
84+
cl_git_pass(git_branch_set_upstream(branch, "test/master"));
85+
86+
assert_config_entry_value(repository, "branch.test.remote", "test");
87+
assert_config_entry_value(repository, "branch.test.merge", "refs/heads/master");
88+
89+
git_reference_free(branch);
90+
91+
/* check merge branch */
92+
cl_git_pass(git_branch_upstream_merge(&buf, repository, "refs/heads/test"));
93+
cl_assert_equal_s("refs/heads/master", buf.ptr);
94+
git_buf_dispose(&buf);
95+
}
96+
7497
void test_refs_branches_upstream__upstream_remote_empty_value(void)
7598
{
7699
git_repository *repository;

0 commit comments

Comments
 (0)