diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-03-30 06:39:19 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-03-30 18:45:57 +0400 |
commit | a258d8e3574c4e993bf16e0c136d1a5fbc356728 (patch) | |
tree | 25f4fc5e103024fc592cfb568691f24a86d356b5 /tests-clar/refs | |
parent | 81b8c9df4642328a7d0dc0920f1489748371d275 (diff) |
branch: rename 'tracking' to 'upstream'
The term 'tracking' is overloaded. Help distinguish what we mean by
using 'upstream' for this part of the library.
Diffstat (limited to 'tests-clar/refs')
-rw-r--r-- | tests-clar/refs/branches/trackingname.c | 42 | ||||
-rw-r--r-- | tests-clar/refs/branches/upstream.c (renamed from tests-clar/refs/branches/tracking.c) | 38 | ||||
-rw-r--r-- | tests-clar/refs/branches/upstreamname.c | 42 |
3 files changed, 61 insertions, 61 deletions
diff --git a/tests-clar/refs/branches/trackingname.c b/tests-clar/refs/branches/trackingname.c deleted file mode 100644 index 5aee33343..000000000 --- a/tests-clar/refs/branches/trackingname.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "clar_libgit2.h" -#include "branch.h" - -static git_repository *repo; -static git_buf tracking_name; - -void test_refs_branches_trackingname__initialize(void) -{ - cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); - - git_buf_init(&tracking_name, 0); -} - -void test_refs_branches_trackingname__cleanup(void) -{ - git_buf_free(&tracking_name); - - git_repository_free(repo); - repo = NULL; -} - -void test_refs_branches_trackingname__can_retrieve_the_remote_tracking_reference_name_of_a_local_branch(void) -{ - cl_git_pass(git_branch_tracking__name( - &tracking_name, repo, "refs/heads/master")); - - cl_assert_equal_s("refs/remotes/test/master", git_buf_cstr(&tracking_name)); -} - -void test_refs_branches_trackingname__can_retrieve_the_local_tracking_reference_name_of_a_local_branch(void) -{ - cl_git_pass(git_branch_tracking__name( - &tracking_name, repo, "refs/heads/track-local")); - - cl_assert_equal_s("refs/heads/master", git_buf_cstr(&tracking_name)); -} - -void test_refs_branches_trackingname__can_return_the_size_of_thelocal_tracking_reference_name_of_a_local_branch(void) -{ - cl_assert_equal_i((int)strlen("refs/heads/master") + 1, - git_branch_tracking_name(NULL, 0, repo, "refs/heads/track-local")); -} diff --git a/tests-clar/refs/branches/tracking.c b/tests-clar/refs/branches/upstream.c index 30599d9fc..fca254161 100644 --- a/tests-clar/refs/branches/tracking.c +++ b/tests-clar/refs/branches/upstream.c @@ -2,19 +2,19 @@ #include "refs.h" static git_repository *repo; -static git_reference *branch, *tracking; +static git_reference *branch, *upstream; -void test_refs_branches_tracking__initialize(void) +void test_refs_branches_upstream__initialize(void) { cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); branch = NULL; - tracking = NULL; + upstream = NULL; } -void test_refs_branches_tracking__cleanup(void) +void test_refs_branches_upstream__cleanup(void) { - git_reference_free(tracking); + git_reference_free(upstream); git_reference_free(branch); branch = NULL; @@ -22,43 +22,43 @@ void test_refs_branches_tracking__cleanup(void) repo = NULL; } -void test_refs_branches_tracking__can_retrieve_the_remote_tracking_reference_of_a_local_branch(void) +void test_refs_branches_upstream__can_retrieve_the_remote_tracking_reference_of_a_local_branch(void) { cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); - cl_git_pass(git_branch_tracking(&tracking, branch)); + cl_git_pass(git_branch_upstream(&upstream, branch)); - cl_assert_equal_s("refs/remotes/test/master", git_reference_name(tracking)); + cl_assert_equal_s("refs/remotes/test/master", git_reference_name(upstream)); } -void test_refs_branches_tracking__can_retrieve_the_local_tracking_reference_of_a_local_branch(void) +void test_refs_branches_upstream__can_retrieve_the_local_upstream_reference_of_a_local_branch(void) { cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/track-local")); - cl_git_pass(git_branch_tracking(&tracking, branch)); + cl_git_pass(git_branch_upstream(&upstream, branch)); - cl_assert_equal_s("refs/heads/master", git_reference_name(tracking)); + cl_assert_equal_s("refs/heads/master", git_reference_name(upstream)); } -void test_refs_branches_tracking__cannot_retrieve_a_remote_tracking_reference_from_a_non_branch(void) +void test_refs_branches_upstream__cannot_retrieve_a_remote_upstream_reference_from_a_non_branch(void) { cl_git_pass(git_reference_lookup(&branch, repo, "refs/tags/e90810b")); - cl_git_fail(git_branch_tracking(&tracking, branch)); + cl_git_fail(git_branch_upstream(&upstream, branch)); } -void test_refs_branches_tracking__trying_to_retrieve_a_remote_tracking_reference_from_a_plain_local_branch_returns_GIT_ENOTFOUND(void) +void test_refs_branches_upstream__trying_to_retrieve_a_remote_tracking_reference_from_a_plain_local_branch_returns_GIT_ENOTFOUND(void) { cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/subtrees")); - cl_assert_equal_i(GIT_ENOTFOUND, git_branch_tracking(&tracking, branch)); + cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch)); } -void test_refs_branches_tracking__trying_to_retrieve_a_remote_tracking_reference_from_a_branch_with_no_fetchspec_returns_GIT_ENOTFOUND(void) +void test_refs_branches_upstream__trying_to_retrieve_a_remote_tracking_reference_from_a_branch_with_no_fetchspec_returns_GIT_ENOTFOUND(void) { cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/cannot-fetch")); - cl_assert_equal_i(GIT_ENOTFOUND, git_branch_tracking(&tracking, branch)); + cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch)); } static void assert_merge_and_or_remote_key_missing(git_repository *repository, const git_commit *target, const char *entry_name) @@ -68,12 +68,12 @@ static void assert_merge_and_or_remote_key_missing(git_repository *repository, c cl_assert_equal_i(GIT_OBJ_COMMIT, git_object_type((git_object*)target)); cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0)); - cl_assert_equal_i(GIT_ENOTFOUND, git_branch_tracking(&tracking, branch)); + cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch)); git_reference_free(branch); } -void test_refs_branches_tracking__retrieve_a_remote_tracking_reference_from_a_branch_with_no_remote_returns_GIT_ENOTFOUND(void) +void test_refs_branches_upstream__retrieve_a_remote_tracking_reference_from_a_branch_with_no_remote_returns_GIT_ENOTFOUND(void) { git_reference *head; git_repository *repository; diff --git a/tests-clar/refs/branches/upstreamname.c b/tests-clar/refs/branches/upstreamname.c new file mode 100644 index 000000000..f05607d44 --- /dev/null +++ b/tests-clar/refs/branches/upstreamname.c @@ -0,0 +1,42 @@ +#include "clar_libgit2.h" +#include "branch.h" + +static git_repository *repo; +static git_buf upstream_name; + +void test_refs_branches_upstreamname__initialize(void) +{ + cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); + + git_buf_init(&upstream_name, 0); +} + +void test_refs_branches_upstreamname__cleanup(void) +{ + git_buf_free(&upstream_name); + + git_repository_free(repo); + repo = NULL; +} + +void test_refs_branches_upstreamname__can_retrieve_the_remote_tracking_reference_name_of_a_local_branch(void) +{ + cl_git_pass(git_branch_upstream__name( + &upstream_name, repo, "refs/heads/master")); + + cl_assert_equal_s("refs/remotes/test/master", git_buf_cstr(&upstream_name)); +} + +void test_refs_branches_upstreamname__can_retrieve_the_local_upstream_reference_name_of_a_local_branch(void) +{ + cl_git_pass(git_branch_upstream__name( + &upstream_name, repo, "refs/heads/track-local")); + + cl_assert_equal_s("refs/heads/master", git_buf_cstr(&upstream_name)); +} + +void test_refs_branches_upstreamname__can_return_the_size_of_thelocal_upstream_reference_name_of_a_local_branch(void) +{ + cl_assert_equal_i((int)strlen("refs/heads/master") + 1, + git_branch_upstream_name(NULL, 0, repo, "refs/heads/track-local")); +} |