diff options
author | Dmitry Lobanov <gaussblurinc@gmail.com> | 2021-06-18 15:47:15 +0300 |
---|---|---|
committer | Dmitry Lobanov <gaussblurinc@gmail.com> | 2021-06-18 15:47:15 +0300 |
commit | 55f2abb834e28fc6f04327a1a24b73f0de2b9487 (patch) | |
tree | 7c8eb6fccfd933d295e73bbd3c4b514b74f2cf37 | |
parent | 94571908f82daba41c7368c79a4f4204405948cf (diff) | |
download | libgit2-55f2abb834e28fc6f04327a1a24b73f0de2b9487.tar.gz |
tests: upstream merge test has been added.
-rw-r--r-- | tests/refs/branches/upstream.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/refs/branches/upstream.c b/tests/refs/branches/upstream.c index 928a9ff7b..f6fd509b8 100644 --- a/tests/refs/branches/upstream.c +++ b/tests/refs/branches/upstream.c @@ -71,6 +71,29 @@ void test_refs_branches_upstream__upstream_remote(void) git_buf_dispose(&buf); } +void test_refs_branches_upstream__upstream_merge(void) +{ + git_reference *branch; + git_repository *repository; + git_buf buf = GIT_BUF_INIT; + + repository = cl_git_sandbox_init("testrepo.git"); + + /* check repository */ + cl_git_pass(git_reference_lookup(&branch, repository, "refs/heads/test")); + cl_git_pass(git_branch_set_upstream(branch, "test/master")); + + assert_config_entry_value(repository, "branch.test.remote", "test"); + assert_config_entry_value(repository, "branch.test.merge", "refs/heads/master"); + + git_reference_free(branch); + + /* check merge branch */ + cl_git_pass(git_branch_upstream_merge(&buf, repository, "refs/heads/test")); + cl_assert_equal_s("refs/heads/master", buf.ptr); + git_buf_dispose(&buf); +} + void test_refs_branches_upstream__upstream_remote_empty_value(void) { git_repository *repository; |