Rename to git_reference_name_to_oid
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
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 6f2ac3c..2073aab 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -40,7 +40,8 @@ GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_reposito
* @param name The long name for the reference
* @return 0 on success, -1 if name could not be resolved
*/
-GIT_EXTERN(int) git_reference_lookup_oid(git_oid *out, git_repository *repo, const char *name);
+GIT_EXTERN(int) git_reference_name_to_oid(
+ git_oid *out, git_repository *repo, const char *name);
/**
* Create a new symbolic reference.
diff --git a/src/refs.c b/src/refs.c
index 6fffe3e..bea1f17 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1061,7 +1061,7 @@ int git_reference_lookup(git_reference **ref_out,
return git_reference_lookup_resolved(ref_out, repo, name, 0);
}
-int git_reference_lookup_oid(
+int git_reference_name_to_oid(
git_oid *out, git_repository *repo, const char *name)
{
int error;
diff --git a/src/revwalk.c b/src/revwalk.c
index a88fc84..a625760 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -494,7 +494,7 @@ static int push_ref(git_revwalk *walk, const char *refname, int hide)
{
git_oid oid;
- if (git_reference_lookup_oid(&oid, walk->repo, refname) < 0)
+ if (git_reference_name_to_oid(&oid, walk->repo, refname) < 0)
return -1;
return push_commit(walk, &oid, hide);
diff --git a/src/status.c b/src/status.c
index d4f59e3..62cc37e 100644
--- a/src/status.c
+++ b/src/status.c
@@ -23,7 +23,7 @@ static int resolve_head_to_tree(git_tree **tree, git_repository *repo)
git_oid head_oid;
git_object *obj = NULL;
- if (git_reference_lookup_oid(&head_oid, repo, GIT_HEAD_FILE) < 0) {
+ if (git_reference_name_to_oid(&head_oid, repo, GIT_HEAD_FILE) < 0) {
/* cannot resolve HEAD - probably brand new repo */
giterr_clear();
*tree = NULL;
diff --git a/src/transports/local.c b/src/transports/local.c
index ba1cee4..5dc3501 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -35,7 +35,7 @@ static int add_ref(transport_local *t, const char *name)
head->name = git__strdup(name);
GITERR_CHECK_ALLOC(head->name);
- if (git_reference_lookup_oid(&head->oid, t->repo, name) < 0 ||
+ if (git_reference_name_to_oid(&head->oid, t->repo, name) < 0 ||
git_vector_insert(&t->refs, head) < 0)
{
git__free(head->name);
diff --git a/tests-clar/refs/lookup.c b/tests-clar/refs/lookup.c
index d9b6c26..ab563ac 100644
--- a/tests-clar/refs/lookup.c
+++ b/tests-clar/refs/lookup.c
@@ -36,7 +36,7 @@ void test_refs_lookup__oid(void)
{
git_oid tag, expected;
- cl_git_pass(git_reference_lookup_oid(&tag, g_repo, "refs/tags/point_to_blob"));
+ cl_git_pass(git_reference_name_to_oid(&tag, g_repo, "refs/tags/point_to_blob"));
cl_git_pass(git_oid_fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
cl_assert(git_oid_cmp(&tag, &expected) == 0);
}