mirror of
https://git.proxmox.com/git/libgit2
synced 2025-11-03 11:12:27 +00:00
repo: Rename HEAD-related methods
This commit is contained in:
parent
e053c911cf
commit
c682886e8e
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user