Skip to content

Commit b2c2dc6

Browse files
authored
Merge pull request libgit2#4940 from libgit2/ethomson/git_obj
More `git_obj` to `git_object` updates
2 parents c352e56 + 8315101 commit b2c2dc6

File tree

20 files changed

+51
-51
lines changed

20 files changed

+51
-51
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
}

include/git2/types.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef int64_t git_time_t;
6969
/** Basic type (loose or packed) of any Git object. */
7070
typedef enum {
7171
GIT_OBJECT_ANY = -2, /**< Object can be any of the following */
72-
GIT_OBJECT_BAD = -1, /**< Object is invalid. */
72+
GIT_OBJECT_INVALID = -1, /**< Object is invalid. */
7373
GIT_OBJECT_COMMIT = 1, /**< A commit object. */
7474
GIT_OBJECT_TREE = 2, /**< A tree (directory listing) object. */
7575
GIT_OBJECT_BLOB = 3, /**< A file revision object. */
@@ -450,16 +450,16 @@ typedef struct git_mailmap git_mailmap;
450450

451451
/**@{*/
452452

453-
#define GIT_OBJ_ANY GIT_OBJECT_ANY
454-
#define GIT_OBJ_BAD GIT_OBJECT_BAD
455-
#define GIT_OBJ__EXT1 0
456-
#define GIT_OBJ_COMMIT GIT_OBJECT_COMMIT
457-
#define GIT_OBJ_TREE GIT_OBJECT_TREE
458-
#define GIT_OBJ_BLOB GIT_OBJECT_BLOB
459-
#define GIT_OBJ_TAG GIT_OBJECT_TAG
460-
#define GIT_OBJ__EXT2 5
461-
#define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
462-
#define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
453+
GIT_DEPRECATED(static const int) GIT_OBJ_ANY = GIT_OBJECT_ANY;
454+
GIT_DEPRECATED(static const int) GIT_OBJ_BAD = GIT_OBJECT_INVALID;
455+
GIT_DEPRECATED(static const int) GIT_OBJ__EXT1 = 0;
456+
GIT_DEPRECATED(static const int) GIT_OBJ_COMMIT = GIT_OBJECT_COMMIT;
457+
GIT_DEPRECATED(static const int) GIT_OBJ_TREE = GIT_OBJECT_TREE;
458+
GIT_DEPRECATED(static const int) GIT_OBJ_BLOB = GIT_OBJECT_BLOB;
459+
GIT_DEPRECATED(static const int) GIT_OBJ_TAG = GIT_OBJECT_TAG;
460+
GIT_DEPRECATED(static const int) GIT_OBJ__EXT2 = 5;
461+
GIT_DEPRECATED(static const int) GIT_OBJ_OFS_DELTA = GIT_OBJECT_OFS_DELTA;
462+
GIT_DEPRECATED(static const int) GIT_OBJ_REF_DELTA = GIT_OBJECT_REF_DELTA;
463463

464464
#define git_otype git_object_t
465465

0 commit comments

Comments
 (0)