Skip to content

Commit 168fe39

Browse files
committed
object_type: use new enumeration names
Use the new object_type enumeration names within the codebase.
1 parent 18e71e6 commit 168fe39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+731
-728
lines changed

src/annotated_commit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int git_annotated_commit_from_revspec(
105105
if ((error = git_revparse_single(&obj, repo, revspec)) < 0)
106106
return error;
107107

108-
if ((error = git_object_peel(&commit, obj, GIT_OBJ_COMMIT))) {
108+
if ((error = git_object_peel(&commit, obj, GIT_OBJECT_COMMIT))) {
109109
git_object_free(obj);
110110
return error;
111111
}
@@ -132,7 +132,7 @@ int git_annotated_commit_from_ref(
132132

133133
if ((error = git_reference_resolve(&resolved, ref)) < 0)
134134
return error;
135-
135+
136136
error = annotated_commit_init_from_id(out,
137137
repo,
138138
git_reference_target(resolved),

src/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static int load_blob(git_blame *blame)
315315
if (error < 0)
316316
goto cleanup;
317317
error = git_object_lookup_bypath((git_object**)&blame->final_blob,
318-
(git_object*)blame->final, blame->path, GIT_OBJ_BLOB);
318+
(git_object*)blame->final, blame->path, GIT_OBJECT_BLOB);
319319

320320
cleanup:
321321
return error;

src/blame_git.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static int make_origin(git_blame__origin **out, git_commit *commit, const char *
4343
int error = 0;
4444

4545
if ((error = git_object_lookup_bypath(&blob, (git_object*)commit,
46-
path, GIT_OBJ_BLOB)) < 0)
46+
path, GIT_OBJECT_BLOB)) < 0)
4747
return error;
4848

4949
GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len);
@@ -257,7 +257,7 @@ static void split_blame(git_blame *blame, git_blame__entry *split, git_blame__en
257257
}
258258
}
259259

260-
/*
260+
/*
261261
* After splitting the blame, the origins used by the on-stack blame_entry
262262
* should lose one refcnt each.
263263
*/
@@ -486,7 +486,7 @@ static int pass_whole_blame(git_blame *blame,
486486

487487
if (!porigin->blob &&
488488
git_object_lookup((git_object**)&porigin->blob, blame->repository,
489-
git_blob_id(origin->blob), GIT_OBJ_BLOB) < 0)
489+
git_blob_id(origin->blob), GIT_OBJECT_BLOB) < 0)
490490
return -1;
491491
for (e=blame->ent; e; e=e->next) {
492492
if (!same_suspect(e->suspect, origin))

src/blob.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int git_blob_create_frombuffer(
8080
assert(id && repo);
8181

8282
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
83-
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < 0)
83+
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJECT_BLOB)) < 0)
8484
return error;
8585

8686
if ((error = git_odb_stream_write(stream, buffer, len)) == 0)
@@ -100,7 +100,7 @@ static int write_file_stream(
100100
git_off_t written = 0;
101101

102102
if ((error = git_odb_open_wstream(
103-
&stream, odb, file_size, GIT_OBJ_BLOB)) < 0)
103+
&stream, odb, file_size, GIT_OBJECT_BLOB)) < 0)
104104
return error;
105105

106106
if ((fd = git_futils_open_ro(path)) < 0) {
@@ -143,7 +143,7 @@ static int write_file_filtered(
143143
if (!error) {
144144
*size = tgt.size;
145145

146-
error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJ_BLOB);
146+
error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJECT_BLOB);
147147
}
148148

149149
git_buf_dispose(&tgt);
@@ -167,7 +167,7 @@ static int write_symlink(
167167
return -1;
168168
}
169169

170-
error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJ_BLOB);
170+
error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJECT_BLOB);
171171
git__free(link_data);
172172
return error;
173173
}

src/cache.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ ssize_t git_cache__max_storage = (256 * 1024 * 1024);
2020
git_atomic_ssize git_cache__current_storage = {0};
2121

2222
static size_t git_cache__max_object_size[8] = {
23-
0, /* GIT_OBJ__EXT1 */
24-
4096, /* GIT_OBJ_COMMIT */
25-
4096, /* GIT_OBJ_TREE */
26-
0, /* GIT_OBJ_BLOB */
27-
4096, /* GIT_OBJ_TAG */
28-
0, /* GIT_OBJ__EXT2 */
29-
0, /* GIT_OBJ_OFS_DELTA */
30-
0 /* GIT_OBJ_REF_DELTA */
23+
0, /* GIT_OBJECT__EXT1 */
24+
4096, /* GIT_OBJECT_COMMIT */
25+
4096, /* GIT_OBJECT_TREE */
26+
0, /* GIT_OBJECT_BLOB */
27+
4096, /* GIT_OBJECT_TAG */
28+
0, /* GIT_OBJECT__EXT2 */
29+
0, /* GIT_OBJECT_OFS_DELTA */
30+
0 /* GIT_OBJECT_REF_DELTA */
3131
};
3232

33-
int git_cache_set_max_object_size(git_otype type, size_t size)
33+
int git_cache_set_max_object_size(git_object_t type, size_t size)
3434
{
3535
if (type < 0 || (size_t)type >= ARRAY_SIZE(git_cache__max_object_size)) {
3636
giterr_set(GITERR_INVALID, "type out of range");
@@ -140,7 +140,7 @@ static void cache_evict_entries(git_cache *cache)
140140
git_atomic_ssize_add(&git_cache__current_storage, -evicted_memory);
141141
}
142142

143-
static bool cache_should_store(git_otype object_type, size_t object_size)
143+
static bool cache_should_store(git_object_t object_type, size_t object_size)
144144
{
145145
size_t max_size = git_cache__max_object_size[object_type];
146146
return git_cache__enabled && object_size < max_size;

src/cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum {
2424

2525
typedef struct {
2626
git_oid oid;
27-
int16_t type; /* git_otype value */
27+
int16_t type; /* git_object_t value */
2828
uint16_t flags; /* GIT_CACHE_STORE value */
2929
size_t size;
3030
git_atomic refcount;
@@ -40,7 +40,7 @@ extern bool git_cache__enabled;
4040
extern ssize_t git_cache__max_storage;
4141
extern git_atomic_ssize git_cache__current_storage;
4242

43-
int git_cache_set_max_object_size(git_otype type, size_t size);
43+
int git_cache_set_max_object_size(git_object_t type, size_t size);
4444

4545
int git_cache_init(git_cache *cache);
4646
void git_cache_free(git_cache *cache);

src/checkout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@ static int checkout_lookup_head_tree(git_tree **out, git_repository *repo)
19441944
git_object *head;
19451945

19461946
if (!(error = git_repository_head(&ref, repo)) &&
1947-
!(error = git_reference_peel(&head, ref, GIT_OBJ_TREE)))
1947+
!(error = git_reference_peel(&head, ref, GIT_OBJECT_TREE)))
19481948
*out = (git_tree *)head;
19491949

19501950
git_reference_free(ref);
@@ -2749,7 +2749,7 @@ int git_checkout_tree(
27492749
repo = git_object_owner(treeish);
27502750

27512751
if (treeish) {
2752-
if (git_object_peel((git_object **)&tree, treeish, GIT_OBJ_TREE) < 0) {
2752+
if (git_object_peel((git_object **)&tree, treeish, GIT_OBJECT_TREE) < 0) {
27532753
giterr_set(
27542754
GITERR_CHECKOUT, "provided object cannot be peeled to a tree");
27552755
return -1;

src/cherrypick.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int git_cherrypick(
198198
(error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
199199
(error = write_cherrypick_head(repo, commit_oidstr)) < 0 ||
200200
(error = git_repository_head(&our_ref, repo)) < 0 ||
201-
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
201+
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
202202
(error = git_cherrypick_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
203203
(error = git_merge__check_result(repo, index)) < 0 ||
204204
(error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||

src/commit.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ static int validate_tree_and_parents(git_array_oid_t *parents, git_repository *r
8888
git_oid *parent_cpy;
8989
const git_oid *parent;
9090

91-
if (validate && !git_object__is_valid(repo, tree, GIT_OBJ_TREE))
91+
if (validate && !git_object__is_valid(repo, tree, GIT_OBJECT_TREE))
9292
return -1;
9393

9494
i = 0;
9595
while ((parent = parent_cb(i, parent_payload)) != NULL) {
96-
if (validate && !git_object__is_valid(repo, parent, GIT_OBJ_COMMIT)) {
96+
if (validate && !git_object__is_valid(repo, parent, GIT_OBJECT_COMMIT)) {
9797
error = -1;
9898
goto on_error;
9999
}
@@ -164,7 +164,7 @@ static int git_commit__create_internal(
164164
if (git_odb__freshen(odb, tree) < 0)
165165
goto cleanup;
166166

167-
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJ_COMMIT) < 0)
167+
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJECT_COMMIT) < 0)
168168
goto cleanup;
169169

170170

@@ -730,7 +730,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
730730
if ((error = git_odb_read(&obj, odb, commit_id)) < 0)
731731
return error;
732732

733-
if (obj->cached.type != GIT_OBJ_COMMIT) {
733+
if (obj->cached.type != GIT_OBJECT_COMMIT) {
734734
giterr_set(GITERR_INVALID, "the requested type does not match the type in ODB");
735735
error = GIT_ENOTFOUND;
736736
goto cleanup;
@@ -890,7 +890,7 @@ int git_commit_create_with_signature(
890890
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
891891
goto cleanup;
892892

893-
if ((error = git_odb_write(out, odb, commit.ptr, commit.size, GIT_OBJ_COMMIT)) < 0)
893+
if ((error = git_odb_write(out, odb, commit.ptr, commit.size, GIT_OBJECT_COMMIT)) < 0)
894894
goto cleanup;
895895

896896
cleanup:

src/commit_list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
192192
if ((error = git_odb_read(&obj, walk->odb, &commit->oid)) < 0)
193193
return error;
194194

195-
if (obj->cached.type != GIT_OBJ_COMMIT) {
195+
if (obj->cached.type != GIT_OBJECT_COMMIT) {
196196
giterr_set(GITERR_INVALID, "object is no commit object");
197197
error = -1;
198198
} else

0 commit comments

Comments
 (0)