Commit c682886e by Vicent Marti

repo: Rename HEAD-related methods

parent e053c911
...@@ -228,7 +228,7 @@ GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path, ...@@ -228,7 +228,7 @@ GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path,
* @return 1 if HEAD is detached, 0 if i'ts not; error code if there * @return 1 if HEAD is detached, 0 if i'ts not; error code if there
* was an error. * was an error.
*/ */
int git_repository_is_detached(git_repository *repo); int git_repository_head_detached(git_repository *repo);
/** /**
* Check if the current branch is an orphan * Check if the current branch is an orphan
...@@ -240,7 +240,7 @@ int git_repository_is_detached(git_repository *repo); ...@@ -240,7 +240,7 @@ int git_repository_is_detached(git_repository *repo);
* @return 1 if the current branch is an orphan, 0 if it's not; error * @return 1 if the current branch is an orphan, 0 if it's not; error
* code if therewas an error * code if therewas an error
*/ */
int git_repository_is_orphan(git_repository *repo); int git_repository_head_orphan(git_repository *repo);
/** /**
* Check if a repository is empty * Check if a repository is empty
......
...@@ -752,7 +752,7 @@ cleanup: ...@@ -752,7 +752,7 @@ cleanup:
return git__rethrow(error, "Failed to (re)init the repository `%s`", path); return git__rethrow(error, "Failed to (re)init the repository `%s`", path);
} }
int git_repository_is_detached(git_repository *repo) int git_repository_head_detached(git_repository *repo)
{ {
git_reference *ref; git_reference *ref;
int error; int error;
...@@ -776,7 +776,7 @@ int git_repository_is_detached(git_repository *repo) ...@@ -776,7 +776,7 @@ int git_repository_is_detached(git_repository *repo)
return 1; return 1;
} }
int git_repository_is_orphan(git_repository *repo) int git_repository_head_orphan(git_repository *repo)
{ {
git_reference *ref; git_reference *ref;
int error; int error;
......
...@@ -275,16 +275,16 @@ BEGIN_TEST(detached0, "test if HEAD is detached") ...@@ -275,16 +275,16 @@ BEGIN_TEST(detached0, "test if HEAD is detached")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER)); must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
must_be_true(git_repository_is_detached(repo) == 0); must_be_true(git_repository_head_detached(repo) == 0);
/* detach the HEAD */ /* detach the HEAD */
git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd"); git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd");
must_pass(git_reference_create_oid_f(&ref, repo, "HEAD", &oid)); must_pass(git_reference_create_oid(&ref, repo, "HEAD", &oid, 1));
must_be_true(git_repository_is_detached(repo) == 1); must_be_true(git_repository_head_detached(repo) == 1);
/* take the reop back to it's original state */ /* take the reop back to it's original state */
must_pass(git_reference_create_symbolic_f(&ref, repo, "HEAD", "refs/heads/master")); must_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
must_be_true(git_repository_is_detached(repo) == 0); must_be_true(git_repository_head_detached(repo) == 0);
git_repository_free(repo); git_repository_free(repo);
END_TEST END_TEST
...@@ -295,15 +295,15 @@ BEGIN_TEST(orphan0, "test if HEAD is orphan") ...@@ -295,15 +295,15 @@ BEGIN_TEST(orphan0, "test if HEAD is orphan")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER)); must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
must_be_true(git_repository_is_orphan(repo) == 0); must_be_true(git_repository_head_orphan(repo) == 0);
/* orphan HEAD */ /* orphan HEAD */
must_pass(git_reference_create_symbolic_f(&ref, repo, "HEAD", "refs/heads/orphan")); must_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/orphan", 1));
must_be_true(git_repository_is_orphan(repo) == 1); must_be_true(git_repository_head_orphan(repo) == 1);
/* take the reop back to it's original state */ /* take the reop back to it's original state */
must_pass(git_reference_create_symbolic_f(&ref, repo, "HEAD", "refs/heads/master")); must_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
must_be_true(git_repository_is_orphan(repo) == 0); must_be_true(git_repository_head_orphan(repo) == 0);
git_repository_free(repo); git_repository_free(repo);
END_TEST END_TEST
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment