Commit 83151018ef0228b53739cbc2bc785a673752c349

Edward Thomson 2019-01-17T10:47:32

object_type: convert final internal users to new names Update some missed types that were continuing to use the old `GIT_OBJ` names.

diff --git a/examples/cat-file.c b/examples/cat-file.c
index f948740..0fb7d45 100644
--- a/examples/cat-file.c
+++ b/examples/cat-file.c
@@ -168,16 +168,16 @@ int main(int argc, char *argv[])
 	case SHOW_PRETTY:
 
 		switch (git_object_type(obj)) {
-		case GIT_OBJ_BLOB:
+		case GIT_OBJECT_BLOB:
 			show_blob((const git_blob *)obj);
 			break;
-		case GIT_OBJ_COMMIT:
+		case GIT_OBJECT_COMMIT:
 			show_commit((const git_commit *)obj);
 			break;
-		case GIT_OBJ_TREE:
+		case GIT_OBJECT_TREE:
 			show_tree((const git_tree *)obj);
 			break;
-		case GIT_OBJ_TAG:
+		case GIT_OBJECT_TAG:
 			show_tag((const git_tag *)obj);
 			break;
 		default:
diff --git a/examples/common.c b/examples/common.c
index 8c10424..4e0949b 100644
--- a/examples/common.c
+++ b/examples/common.c
@@ -250,7 +250,7 @@ void treeish_to_tree(
 		"looking up object", treeish);
 
 	check_lg2(
-		git_object_peel((git_object **)out, obj, GIT_OBJ_TREE),
+		git_object_peel((git_object **)out, obj, GIT_OBJECT_TREE),
 		"resolving object to tree", treeish);
 
 	git_object_free(obj);
diff --git a/examples/for-each-ref.c b/examples/for-each-ref.c
index a8ceaaf..dd6d35c 100644
--- a/examples/for-each-ref.c
+++ b/examples/for-each-ref.c
@@ -18,7 +18,7 @@ static int show_ref(git_reference *ref, void *data)
         oid = git_reference_target(resolved ? resolved : ref);
         git_oid_fmt(hex, oid);
         hex[GIT_OID_HEXSZ] = 0;
-        check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJ_ANY),
+        check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJECT_ANY),
                   "Unable to lookup object", hex);
 
         printf("%s %-6s\t%s\n",
diff --git a/examples/general.c b/examples/general.c
index 15b415a..c1c8c0c 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -241,7 +241,7 @@ static void object_database(git_repository *repo, git_oid *oid)
 	 * we'll write a new blob object that just contains a simple string.
 	 * Notice that we have to specify the object type as the `git_otype` enum.
 	 */
-	git_odb_write(oid, odb, "test data", sizeof("test data") - 1, GIT_OBJ_BLOB);
+	git_odb_write(oid, odb, "test data", sizeof("test data") - 1, GIT_OBJECT_BLOB);
 
 	/**
 	 * 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)
 	 */
 	git_tag_target((git_object **)&commit, tag);
 	name = git_tag_name(tag);		/* "test" */
-	type = git_tag_target_type(tag);	/* GIT_OBJ_COMMIT (otype enum) */
+	type = git_tag_target_type(tag);	/* GIT_OBJECT_COMMIT (object_t enum) */
 	message = git_tag_message(tag);		/* "tag message\n" */
 	printf("Tag Name: %s\nTag Type: %s\nTag Message: %s\n",
 		name, git_object_type2string(type), message);
diff --git a/examples/log.c b/examples/log.c
index a107470..3e891e4 100644
--- a/examples/log.c
+++ b/examples/log.c
@@ -275,7 +275,7 @@ static int add_revision(struct log_state *s, const char *revstr)
 				git_object_id(revs.from), git_object_id(revs.to)),
 				"Could not find merge base", revstr);
 			check_lg2(
-				git_object_lookup(&revs.to, s->repo, &base, GIT_OBJ_COMMIT),
+				git_object_lookup(&revs.to, s->repo, &base, GIT_OBJECT_COMMIT),
 				"Could not find merge base commit", NULL);
 
 			push_rev(s, revs.to, hide);
diff --git a/examples/merge.c b/examples/merge.c
index c819ad2..761bd3a 100644
--- a/examples/merge.c
+++ b/examples/merge.c
@@ -153,7 +153,7 @@ static int perform_fastforward(git_repository *repo, const git_oid *target_oid, 
 	}
 
 	/* Lookup the target object */
-	err = git_object_lookup(&target, repo, target_oid, GIT_OBJ_COMMIT);
+	err = git_object_lookup(&target, repo, target_oid, GIT_OBJECT_COMMIT);
 	if (err != 0) {
 		fprintf(stderr, "failed to lookup OID %s\n", git_oid_tostr_s(target_oid));
 		return -1;
@@ -251,7 +251,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, merge_opt
 	if (err < 0) goto cleanup;
 
 	/* Setup our parent commits */
-	err = git_reference_peel((git_object **)&parents[0], head_ref, GIT_OBJ_COMMIT);
+	err = git_reference_peel((git_object **)&parents[0], head_ref, GIT_OBJECT_COMMIT);
 	check_lg2(err, "failed to peel head reference", NULL);
 	for (i = 0; i < opts->annotated_count; i++) {
 		git_commit_lookup(&parents[i + 1], repo, git_annotated_commit_id(opts->annotated[i]));
diff --git a/examples/tag.c b/examples/tag.c
index 29a04c4..fa405b8 100644
--- a/examples/tag.c
+++ b/examples/tag.c
@@ -135,10 +135,10 @@ static int each_tag(const char *name, tag_state *state)
 			"Failed to lookup rev", name);
 
 	switch (git_object_type(obj)) {
-		case GIT_OBJ_TAG:
+		case GIT_OBJECT_TAG:
 			print_tag((git_tag *) obj, state);
 			break;
-		case GIT_OBJ_COMMIT:
+		case GIT_OBJECT_COMMIT:
 			print_commit((git_commit *) obj, name, state);
 			break;
 		default:
diff --git a/fuzzers/objects_fuzzer.c b/fuzzers/objects_fuzzer.c
index a72355a..a1001ed 100644
--- a/fuzzers/objects_fuzzer.c
+++ b/fuzzers/objects_fuzzer.c
@@ -26,7 +26,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 {
 	const git_otype types[] = {
-		GIT_OBJ_BLOB, GIT_OBJ_TREE, GIT_OBJ_COMMIT, GIT_OBJ_TAG
+		GIT_OBJECT_BLOB, GIT_OBJECT_TREE, GIT_OBJECT_COMMIT, GIT_OBJECT_TAG
 	};
 	git_object *object = NULL;
 	size_t i;
diff --git a/fuzzers/packfile_fuzzer.c b/fuzzers/packfile_fuzzer.c
index 6f45387..e70c6c9 100644
--- a/fuzzers/packfile_fuzzer.c
+++ b/fuzzers/packfile_fuzzer.c
@@ -70,7 +70,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 	}
 	git_mempack_reset(mempack);
 
-	if (git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB) < 0) {
+	if (git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB) < 0) {
 		fprintf(stderr, "Failed to add an object to the odb\n");
 		abort();
 	}
@@ -93,7 +93,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 	if (append_hash) {
 		git_oid oid;
-		if (git_odb_hash(&oid, data, size, GIT_OBJ_BLOB) < 0) {
+		if (git_odb_hash(&oid, data, size, GIT_OBJECT_BLOB) < 0) {
 			fprintf(stderr, "Failed to compute the SHA1 hash\n");
 			abort();
 		}
diff --git a/src/annotated_commit.c b/src/annotated_commit.c
index d95d440..5ef2bab 100644
--- a/src/annotated_commit.c
+++ b/src/annotated_commit.c
@@ -130,7 +130,7 @@ int git_annotated_commit_from_ref(
 
 	*out = NULL;
 
-	if ((error = git_reference_peel(&peeled, ref, GIT_OBJ_COMMIT)) < 0)
+	if ((error = git_reference_peel(&peeled, ref, GIT_OBJECT_COMMIT)) < 0)
 		return error;
 
 	error = annotated_commit_init_from_id(out,