Skip to content

Commit 8315101

Browse files
committed
object_type: convert final internal users to new names
Update some missed types that were continuing to use the old `GIT_OBJ` names.
1 parent cd35085 commit 8315101

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

examples/cat-file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,16 @@ int main(int argc, char *argv[])
168168
case SHOW_PRETTY:
169169

170170
switch (git_object_type(obj)) {
171-
case GIT_OBJ_BLOB:
171+
case GIT_OBJECT_BLOB:
172172
show_blob((const git_blob *)obj);
173173
break;
174-
case GIT_OBJ_COMMIT:
174+
case GIT_OBJECT_COMMIT:
175175
show_commit((const git_commit *)obj);
176176
break;
177-
case GIT_OBJ_TREE:
177+
case GIT_OBJECT_TREE:
178178
show_tree((const git_tree *)obj);
179179
break;
180-
case GIT_OBJ_TAG:
180+
case GIT_OBJECT_TAG:
181181
show_tag((const git_tag *)obj);
182182
break;
183183
default:

examples/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void treeish_to_tree(
250250
"looking up object", treeish);
251251

252252
check_lg2(
253-
git_object_peel((git_object **)out, obj, GIT_OBJ_TREE),
253+
git_object_peel((git_object **)out, obj, GIT_OBJECT_TREE),
254254
"resolving object to tree", treeish);
255255

256256
git_object_free(obj);

examples/for-each-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static int show_ref(git_reference *ref, void *data)
1818
oid = git_reference_target(resolved ? resolved : ref);
1919
git_oid_fmt(hex, oid);
2020
hex[GIT_OID_HEXSZ] = 0;
21-
check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJ_ANY),
21+
check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJECT_ANY),
2222
"Unable to lookup object", hex);
2323

2424
printf("%s %-6s\t%s\n",

examples/general.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void object_database(git_repository *repo, git_oid *oid)
241241
* we'll write a new blob object that just contains a simple string.
242242
* Notice that we have to specify the object type as the `git_otype` enum.
243243
*/
244-
git_odb_write(oid, odb, "test data", sizeof("test data") - 1, GIT_OBJ_BLOB);
244+
git_odb_write(oid, odb, "test data", sizeof("test data") - 1, GIT_OBJECT_BLOB);
245245

246246
/**
247247
* Now that we've written the object, we can check out what SHA1 was
@@ -441,7 +441,7 @@ static void tag_parsing(git_repository *repo)
441441
*/
442442
git_tag_target((git_object **)&commit, tag);
443443
name = git_tag_name(tag); /* "test" */
444-
type = git_tag_target_type(tag); /* GIT_OBJ_COMMIT (otype enum) */
444+
type = git_tag_target_type(tag); /* GIT_OBJECT_COMMIT (object_t enum) */
445445
message = git_tag_message(tag); /* "tag message\n" */
446446
printf("Tag Name: %s\nTag Type: %s\nTag Message: %s\n",
447447
name, git_object_type2string(type), message);

examples/log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int add_revision(struct log_state *s, const char *revstr)
275275
git_object_id(revs.from), git_object_id(revs.to)),
276276
"Could not find merge base", revstr);
277277
check_lg2(
278-
git_object_lookup(&revs.to, s->repo, &base, GIT_OBJ_COMMIT),
278+
git_object_lookup(&revs.to, s->repo, &base, GIT_OBJECT_COMMIT),
279279
"Could not find merge base commit", NULL);
280280

281281
push_rev(s, revs.to, hide);

examples/merge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int perform_fastforward(git_repository *repo, const git_oid *target_oid,
153153
}
154154

155155
/* Lookup the target object */
156-
err = git_object_lookup(&target, repo, target_oid, GIT_OBJ_COMMIT);
156+
err = git_object_lookup(&target, repo, target_oid, GIT_OBJECT_COMMIT);
157157
if (err != 0) {
158158
fprintf(stderr, "failed to lookup OID %s\n", git_oid_tostr_s(target_oid));
159159
return -1;
@@ -251,7 +251,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, merge_opt
251251
if (err < 0) goto cleanup;
252252

253253
/* Setup our parent commits */
254-
err = git_reference_peel((git_object **)&parents[0], head_ref, GIT_OBJ_COMMIT);
254+
err = git_reference_peel((git_object **)&parents[0], head_ref, GIT_OBJECT_COMMIT);
255255
check_lg2(err, "failed to peel head reference", NULL);
256256
for (i = 0; i < opts->annotated_count; i++) {
257257
git_commit_lookup(&parents[i + 1], repo, git_annotated_commit_id(opts->annotated[i]));

examples/tag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ static int each_tag(const char *name, tag_state *state)
135135
"Failed to lookup rev", name);
136136

137137
switch (git_object_type(obj)) {
138-
case GIT_OBJ_TAG:
138+
case GIT_OBJECT_TAG:
139139
print_tag((git_tag *) obj, state);
140140
break;
141-
case GIT_OBJ_COMMIT:
141+
case GIT_OBJECT_COMMIT:
142142
print_commit((git_commit *) obj, name, state);
143143
break;
144144
default:

fuzzers/objects_fuzzer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
2626
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
2727
{
2828
const git_otype types[] = {
29-
GIT_OBJ_BLOB, GIT_OBJ_TREE, GIT_OBJ_COMMIT, GIT_OBJ_TAG
29+
GIT_OBJECT_BLOB, GIT_OBJECT_TREE, GIT_OBJECT_COMMIT, GIT_OBJECT_TAG
3030
};
3131
git_object *object = NULL;
3232
size_t i;

fuzzers/packfile_fuzzer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
7070
}
7171
git_mempack_reset(mempack);
7272

73-
if (git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB) < 0) {
73+
if (git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB) < 0) {
7474
fprintf(stderr, "Failed to add an object to the odb\n");
7575
abort();
7676
}
@@ -93,7 +93,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
9393
goto cleanup;
9494
if (append_hash) {
9595
git_oid oid;
96-
if (git_odb_hash(&oid, data, size, GIT_OBJ_BLOB) < 0) {
96+
if (git_odb_hash(&oid, data, size, GIT_OBJECT_BLOB) < 0) {
9797
fprintf(stderr, "Failed to compute the SHA1 hash\n");
9898
abort();
9999
}

src/annotated_commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int git_annotated_commit_from_ref(
130130

131131
*out = NULL;
132132

133-
if ((error = git_reference_peel(&peeled, ref, GIT_OBJ_COMMIT)) < 0)
133+
if ((error = git_reference_peel(&peeled, ref, GIT_OBJECT_COMMIT)) < 0)
134134
return error;
135135

136136
error = annotated_commit_init_from_id(out,

0 commit comments

Comments
 (0)