repo: Rename HEAD-related methods
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/include/git2/repository.h b/include/git2/repository.h
index ddadab4..9344db7 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -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
* 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
@@ -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
* 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
diff --git a/src/repository.c b/src/repository.c
index a99c301..9698803 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -752,7 +752,7 @@ cleanup:
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;
int error;
@@ -776,7 +776,7 @@ int git_repository_is_detached(git_repository *repo)
return 1;
}
-int git_repository_is_orphan(git_repository *repo)
+int git_repository_head_orphan(git_repository *repo)
{
git_reference *ref;
int error;
diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index b67d27f..534839b 100644
--- a/tests/t12-repo.c
+++ b/tests/t12-repo.c
@@ -275,16 +275,16 @@ BEGIN_TEST(detached0, "test if HEAD is detached")
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 */
git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd");
- must_pass(git_reference_create_oid_f(&ref, repo, "HEAD", &oid));
- must_be_true(git_repository_is_detached(repo) == 1);
+ must_pass(git_reference_create_oid(&ref, repo, "HEAD", &oid, 1));
+ must_be_true(git_repository_head_detached(repo) == 1);
/* take the reop back to it's original state */
- must_pass(git_reference_create_symbolic_f(&ref, repo, "HEAD", "refs/heads/master"));
- must_be_true(git_repository_is_detached(repo) == 0);
+ must_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
+ must_be_true(git_repository_head_detached(repo) == 0);
git_repository_free(repo);
END_TEST
@@ -295,15 +295,15 @@ BEGIN_TEST(orphan0, "test if HEAD is orphan")
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 */
- must_pass(git_reference_create_symbolic_f(&ref, repo, "HEAD", "refs/heads/orphan"));
- must_be_true(git_repository_is_orphan(repo) == 1);
+ must_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/orphan", 1));
+ must_be_true(git_repository_head_orphan(repo) == 1);
/* take the reop back to it's original state */
- must_pass(git_reference_create_symbolic_f(&ref, repo, "HEAD", "refs/heads/master"));
- must_be_true(git_repository_is_orphan(repo) == 0);
+ must_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
+ must_be_true(git_repository_head_orphan(repo) == 0);
git_repository_free(repo);
END_TEST