API updates for submodule.h
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index b00fad2..90e45ce 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -318,7 +318,7 @@ GIT_EXTERN(int) git_submodule_set_url(git_submodule *submodule, const char *url)
* @param submodule Pointer to submodule object
* @return Pointer to git_oid or NULL if submodule is not in index.
*/
-GIT_EXTERN(const git_oid *) git_submodule_index_oid(git_submodule *submodule);
+GIT_EXTERN(const git_oid *) git_submodule_index_id(git_submodule *submodule);
/**
* Get the OID for the submodule in the current HEAD tree.
@@ -326,7 +326,7 @@ GIT_EXTERN(const git_oid *) git_submodule_index_oid(git_submodule *submodule);
* @param submodule Pointer to submodule object
* @return Pointer to git_oid or NULL if submodule is not in the HEAD.
*/
-GIT_EXTERN(const git_oid *) git_submodule_head_oid(git_submodule *submodule);
+GIT_EXTERN(const git_oid *) git_submodule_head_id(git_submodule *submodule);
/**
* Get the OID for the submodule in the current working directory.
@@ -339,7 +339,7 @@ GIT_EXTERN(const git_oid *) git_submodule_head_oid(git_submodule *submodule);
* @param submodule Pointer to submodule object
* @return Pointer to git_oid or NULL if submodule is not checked out.
*/
-GIT_EXTERN(const git_oid *) git_submodule_wd_oid(git_submodule *submodule);
+GIT_EXTERN(const git_oid *) git_submodule_wd_id(git_submodule *submodule);
/**
* Get the ignore rule for the submodule.
diff --git a/src/diff.c b/src/diff.c
index d6f5bd4..86f76f9 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -363,7 +363,7 @@ int git_diff__oid_for_file(
const git_oid *sm_oid;
if (!git_submodule_lookup(&sm, repo, path) &&
- (sm_oid = git_submodule_wd_oid(sm)) != NULL)
+ (sm_oid = git_submodule_wd_id(sm)) != NULL)
git_oid_cpy(oid, sm_oid);
else {
/* if submodule lookup failed probably just in an intermediate
@@ -496,7 +496,7 @@ static int maybe_modified(
/* grab OID while we are here */
if (git_oid_iszero(&nitem->oid)) {
- const git_oid *sm_oid = git_submodule_wd_oid(sub);
+ const git_oid *sm_oid = git_submodule_wd_id(sub);
if (sm_oid != NULL) {
git_oid_cpy(&noid, sm_oid);
use_noid = &noid;
diff --git a/src/diff_output.c b/src/diff_output.c
index 7873f06..804325e 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -287,8 +287,8 @@ static int get_workdir_sm_content(
if ((file->flags & GIT_DIFF_FILE_VALID_OID) == 0) {
const git_oid* sm_head;
- if ((sm_head = git_submodule_wd_oid(sm)) != NULL ||
- (sm_head = git_submodule_head_oid(sm)) != NULL)
+ if ((sm_head = git_submodule_wd_id(sm)) != NULL ||
+ (sm_head = git_submodule_head_id(sm)) != NULL)
{
git_oid_cpy(&file->oid, sm_head);
file->flags |= GIT_DIFF_FILE_VALID_OID;
diff --git a/src/submodule.c b/src/submodule.c
index 994ce31..bc38f1f 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -513,7 +513,7 @@ int git_submodule_set_url(git_submodule *submodule, const char *url)
return 0;
}
-const git_oid *git_submodule_index_oid(git_submodule *submodule)
+const git_oid *git_submodule_index_id(git_submodule *submodule)
{
assert(submodule);
@@ -523,7 +523,7 @@ const git_oid *git_submodule_index_oid(git_submodule *submodule)
return NULL;
}
-const git_oid *git_submodule_head_oid(git_submodule *submodule)
+const git_oid *git_submodule_head_id(git_submodule *submodule)
{
assert(submodule);
@@ -533,7 +533,7 @@ const git_oid *git_submodule_head_oid(git_submodule *submodule)
return NULL;
}
-const git_oid *git_submodule_wd_oid(git_submodule *submodule)
+const git_oid *git_submodule_wd_id(git_submodule *submodule)
{
assert(submodule);
@@ -1389,8 +1389,8 @@ cleanup:
static int submodule_index_status(unsigned int *status, git_submodule *sm)
{
- const git_oid *head_oid = git_submodule_head_oid(sm);
- const git_oid *index_oid = git_submodule_index_oid(sm);
+ const git_oid *head_oid = git_submodule_head_id(sm);
+ const git_oid *index_oid = git_submodule_index_id(sm);
if (!head_oid) {
if (index_oid)
@@ -1410,7 +1410,7 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
const git_oid *wd_oid, *index_oid;
git_repository *sm_repo = NULL;
- /* open repo now if we need it (so wd_oid() call won't reopen) */
+ /* open repo now if we need it (so wd_id() call won't reopen) */
if ((sm->ignore == GIT_SUBMODULE_IGNORE_NONE ||
sm->ignore == GIT_SUBMODULE_IGNORE_UNTRACKED) &&
(sm->flags & GIT_SUBMODULE_STATUS_IN_WD) != 0)
@@ -1419,8 +1419,8 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
return error;
}
- index_oid = git_submodule_index_oid(sm);
- wd_oid = git_submodule_wd_oid(sm);
+ index_oid = git_submodule_index_id(sm);
+ wd_oid = git_submodule_wd_id(sm);
if (!index_oid) {
if (wd_oid)
diff --git a/tests-clar/submodule/lookup.c b/tests-clar/submodule/lookup.c
index 94eb19b..868b51e 100644
--- a/tests-clar/submodule/lookup.c
+++ b/tests-clar/submodule/lookup.c
@@ -62,9 +62,9 @@ void test_submodule_lookup__accessors(void)
cl_assert(git__suffixcmp(git_submodule_path(sm), "sm_unchanged") == 0);
cl_assert(git__suffixcmp(git_submodule_url(sm), "/submod2_target") == 0);
- cl_assert(git_oid_streq(git_submodule_index_oid(sm), oid) == 0);
- cl_assert(git_oid_streq(git_submodule_head_oid(sm), oid) == 0);
- cl_assert(git_oid_streq(git_submodule_wd_oid(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_index_id(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_head_id(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_wd_id(sm), oid) == 0);
cl_assert(git_submodule_ignore(sm) == GIT_SUBMODULE_IGNORE_NONE);
cl_assert(git_submodule_update(sm) == GIT_SUBMODULE_UPDATE_CHECKOUT);
@@ -72,24 +72,24 @@ void test_submodule_lookup__accessors(void)
cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_changed_head"));
cl_assert_equal_s("sm_changed_head", git_submodule_name(sm));
- cl_assert(git_oid_streq(git_submodule_index_oid(sm), oid) == 0);
- cl_assert(git_oid_streq(git_submodule_head_oid(sm), oid) == 0);
- cl_assert(git_oid_streq(git_submodule_wd_oid(sm),
+ cl_assert(git_oid_streq(git_submodule_index_id(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_head_id(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_wd_id(sm),
"3d9386c507f6b093471a3e324085657a3c2b4247") == 0);
cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_added_and_uncommited"));
cl_assert_equal_s("sm_added_and_uncommited", git_submodule_name(sm));
- cl_assert(git_oid_streq(git_submodule_index_oid(sm), oid) == 0);
- cl_assert(git_submodule_head_oid(sm) == NULL);
- cl_assert(git_oid_streq(git_submodule_wd_oid(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_index_id(sm), oid) == 0);
+ cl_assert(git_submodule_head_id(sm) == NULL);
+ cl_assert(git_oid_streq(git_submodule_wd_id(sm), oid) == 0);
cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_missing_commits"));
cl_assert_equal_s("sm_missing_commits", git_submodule_name(sm));
- cl_assert(git_oid_streq(git_submodule_index_oid(sm), oid) == 0);
- cl_assert(git_oid_streq(git_submodule_head_oid(sm), oid) == 0);
- cl_assert(git_oid_streq(git_submodule_wd_oid(sm),
+ cl_assert(git_oid_streq(git_submodule_index_id(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_head_id(sm), oid) == 0);
+ cl_assert(git_oid_streq(git_submodule_wd_id(sm),
"5e4963595a9774b90524d35a807169049de8ccad") == 0);
}