Commit c682886e8e06a2a327b3b637303d7b6820efeb60

Vicent Marti 2011-06-28T21:09:22

repo: Rename HEAD-related methods

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