diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2013-09-17 09:50:30 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-09-17 09:50:30 +0200 |
| commit | 605da51a2cfd86901b6fa5f9cf71111a63ab4418 (patch) | |
| tree | dbe23d26a4cbd93d457c68fdec7b4b10605314ac /tests-clar/repo | |
| parent | c62b5ca590fb2f1743f43439b04159b168a36dda (diff) | |
| download | libgit2-605da51a2cfd86901b6fa5f9cf71111a63ab4418.tar.gz | |
No such thing as an orphan branch
Unfortunately git-core uses the term "unborn branch" and "orphan
branch" interchangeably. However, "orphan" is only really there for
the checkout command, which has the `--orphan` option so it doesn't
actually create the branch.
Branches never have parents, so the distinction of a branch with no
parents is odd to begin with. Crucially, the error messages deal with
unborn branches, so let's use that.
Diffstat (limited to 'tests-clar/repo')
| -rw-r--r-- | tests-clar/repo/head.c | 26 | ||||
| -rw-r--r-- | tests-clar/repo/headtree.c | 8 | ||||
| -rw-r--r-- | tests-clar/repo/repo_helpers.c | 2 | ||||
| -rw-r--r-- | tests-clar/repo/repo_helpers.h | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/tests-clar/repo/head.c b/tests-clar/repo/head.c index a9f5cfc58..5a55984bd 100644 --- a/tests-clar/repo/head.c +++ b/tests-clar/repo/head.c @@ -32,20 +32,20 @@ void test_repo_head__head_detached(void) cl_assert_equal_i(false, git_repository_head_detached(repo)); } -void test_repo_head__head_orphan(void) +void test_repo_head__unborn_head(void) { git_reference *ref; cl_git_pass(git_repository_head_detached(repo)); - make_head_orphaned(repo, NON_EXISTING_HEAD); + make_head_unborn(repo, NON_EXISTING_HEAD); - cl_assert(git_repository_head_orphan(repo) == 1); + cl_assert(git_repository_head_unborn(repo) == 1); /* take the repo back to it's original state */ cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1)); - cl_assert(git_repository_head_orphan(repo) == 0); + cl_assert(git_repository_head_unborn(repo) == 0); git_reference_free(ref); } @@ -58,7 +58,7 @@ void test_repo_head__set_head_Attaches_HEAD_to_un_unborn_branch_when_the_branch_ cl_assert_equal_i(false, git_repository_head_detached(repo)); - cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head(&head, repo)); + cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_head(&head, repo)); } void test_repo_head__set_head_Returns_ENOTFOUND_when_the_reference_doesnt_exist(void) @@ -163,20 +163,20 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void git_reference_free(head); } -void test_repo_head__detaching_an_orphaned_head_returns_GIT_EORPHANEDHEAD(void) +void test_repo_head__detaching_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void) { - make_head_orphaned(repo, NON_EXISTING_HEAD); + make_head_unborn(repo, NON_EXISTING_HEAD); - cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_detach_head(repo)); + cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_detach_head(repo)); } -void test_repo_head__retrieving_an_orphaned_head_returns_GIT_EORPHANEDHEAD(void) +void test_repo_head__retrieving_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void) { git_reference *head; - make_head_orphaned(repo, NON_EXISTING_HEAD); + make_head_unborn(repo, NON_EXISTING_HEAD); - cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head(&head, repo)); + cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_head(&head, repo)); } void test_repo_head__retrieving_a_missing_head_returns_GIT_ENOTFOUND(void) @@ -188,9 +188,9 @@ void test_repo_head__retrieving_a_missing_head_returns_GIT_ENOTFOUND(void) cl_assert_equal_i(GIT_ENOTFOUND, git_repository_head(&head, repo)); } -void test_repo_head__can_tell_if_an_orphaned_head_is_detached(void) +void test_repo_head__can_tell_if_an_unborn_head_is_detached(void) { - make_head_orphaned(repo, NON_EXISTING_HEAD); + make_head_unborn(repo, NON_EXISTING_HEAD); cl_assert_equal_i(false, git_repository_head_detached(repo)); } diff --git a/tests-clar/repo/headtree.c b/tests-clar/repo/headtree.c index 0e7fe93e5..e899ac399 100644 --- a/tests-clar/repo/headtree.c +++ b/tests-clar/repo/headtree.c @@ -36,13 +36,13 @@ void test_repo_headtree__can_retrieve_the_root_tree_from_a_non_detached_head(voi cl_assert(git_oid_streq(git_tree_id(tree), "az")); } -void test_repo_headtree__when_head_is_orphaned_returns_EORPHANEDHEAD(void) +void test_repo_headtree__when_head_is_unborn_returns_EUNBORNBRANCH(void) { - make_head_orphaned(repo, NON_EXISTING_HEAD); + make_head_unborn(repo, NON_EXISTING_HEAD); - cl_assert_equal_i(true, git_repository_head_orphan(repo)); + cl_assert_equal_i(true, git_repository_head_unborn(repo)); - cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head_tree(&tree, repo)); + cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_head_tree(&tree, repo)); } void test_repo_headtree__when_head_is_missing_returns_ENOTFOUND(void) diff --git a/tests-clar/repo/repo_helpers.c b/tests-clar/repo/repo_helpers.c index 74902e439..3d477ff42 100644 --- a/tests-clar/repo/repo_helpers.c +++ b/tests-clar/repo/repo_helpers.c @@ -3,7 +3,7 @@ #include "repo_helpers.h" #include "posix.h" -void make_head_orphaned(git_repository* repo, const char *target) +void make_head_unborn(git_repository* repo, const char *target) { git_reference *head; diff --git a/tests-clar/repo/repo_helpers.h b/tests-clar/repo/repo_helpers.h index 09b5cac84..6783d5701 100644 --- a/tests-clar/repo/repo_helpers.h +++ b/tests-clar/repo/repo_helpers.h @@ -2,5 +2,5 @@ #define NON_EXISTING_HEAD "refs/heads/hide/and/seek" -extern void make_head_orphaned(git_repository* repo, const char *target); +extern void make_head_unborn(git_repository* repo, const char *target); extern void delete_head(git_repository* repo); |
