Commit Diff


commit - d22131b7303ad2def2c0270c504eb37afc68ac59
commit + eef6493a8d08ef874a8060f8966241d8c1337168
blob - 54b890a4cdf611d89cafac33844289083e0fc554
blob + 59e948f3f74afcf024e1cab33edf5d0b56c585e7
--- include/got_object.h
+++ include/got_object.h
@@ -63,8 +63,7 @@ struct got_commit_object {
 	char *logmsg;
 };
 
-struct got_object {
-	int type;
+struct got_object;
 #define GOT_OBJ_TYPE_COMMIT		1
 #define GOT_OBJ_TYPE_TREE		2
 #define GOT_OBJ_TYPE_BLOB		3
@@ -73,22 +72,6 @@ struct got_object {
 #define GOT_OBJ_TYPE_OFFSET_DELTA	6
 #define GOT_OBJ_TYPE_REF_DELTA		7
 
-	int flags;
-#define GOT_OBJ_FLAG_PACKED		0x01
-
-	size_t hdrlen;
-	size_t size;
-	struct got_object_id id;
-
-	char *path_packfile;	/* if packed */
-	off_t pack_offset;	/* if packed */
-
-	/* If type is OFFSET_DELTA: */
-	int base_type;
-	uint64_t base_size;
-	off_t base_obj_offset;
-};
-
 struct got_repository;
 
 char *got_object_id_str(struct got_object_id *, char *, size_t);
blob - 3bf0c3c7eaa09b84e6b176a6d650cd3e57ef42ae
blob + cbf2d2f60d7587c6052b0de1eadc1f894429b51d
--- lib/diff.c
+++ lib/diff.c
@@ -163,7 +163,7 @@ diff_modified_blob(struct got_object_id *id1, struct g
 	err = got_object_open(&obj1, repo, id1);
 	if (err)
 		return got_error(GOT_ERR_BAD_OBJ_HDR);
-	if (obj1->type != GOT_OBJ_TYPE_BLOB) {
+	if (got_object_get_type(obj1) != GOT_OBJ_TYPE_BLOB) {
 		err = got_error(GOT_ERR_OBJ_TYPE);
 		goto done;
 	}
@@ -173,7 +173,7 @@ diff_modified_blob(struct got_object_id *id1, struct g
 		err= got_error(GOT_ERR_BAD_OBJ_HDR);
 		goto done;
 	}
-	if (obj2->type != GOT_OBJ_TYPE_BLOB) {
+	if (got_object_get_type(obj2) != GOT_OBJ_TYPE_BLOB) {
 		err = got_error(GOT_ERR_BAD_OBJ_DATA);
 		goto done;
 	}
@@ -265,7 +265,7 @@ diff_modified_tree(struct got_object_id *id1, struct g
 	if (err)
 		goto done;
 
-	if (treeobj1->type != GOT_OBJ_TYPE_TREE) {
+	if (got_object_get_type(treeobj1) != GOT_OBJ_TYPE_TREE) {
 		err = got_error(GOT_ERR_OBJ_TYPE);
 		goto done;
 	}
@@ -274,7 +274,7 @@ diff_modified_tree(struct got_object_id *id1, struct g
 	if (err)
 		goto done;
 
-	if (treeobj2->type != GOT_OBJ_TYPE_TREE) {
+	if (got_object_get_type(treeobj2) != GOT_OBJ_TYPE_TREE) {
 		err = got_error(GOT_ERR_OBJ_TYPE);
 		goto done;
 	}
blob - 9f2bc6f19f925498fcf0679ec4e0b0a4deeee9d8
blob + 5ff0a64ea609322f8b19eb00050c8efb05c57fac
--- lib/object.c
+++ lib/object.c
@@ -31,6 +31,7 @@
 #include "got_repository.h"
 #include "got_sha1.h"
 #include "pack.h"
+#include "object.h"
 
 #ifndef MIN
 #define	MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
blob - a91b59411f042723dc0f4b7c23bb54b076ea2bd1
blob + 86f4debca99a0996d1ad5d5ee01f1073caaa503e
--- lib/pack.c
+++ lib/pack.c
@@ -36,6 +36,7 @@
 #include "pack.h"
 #include "path.h"
 #include "delta.h"
+#include "object.h"
 
 #define GOT_PACK_PREFIX		"pack-"
 #define GOT_PACKFILE_SUFFIX	".pack"
blob - 6495ec45fdd21d9b0882c3766a0ff40302a76137
blob + 7619771580a6f0aa760ab9d92e8f4f43ecae340a
--- regress/repository/repository_test.c
+++ regress/repository/repository_test.c
@@ -261,12 +261,12 @@ repo_diff_blob(const char *repo_path)
 	err = got_object_open(&obj1, repo, &id1);
 	if (err != NULL || obj1 == NULL)
 		return 0;
-	if (obj1->type != GOT_OBJ_TYPE_BLOB)
+	if (got_object_get_type(obj1) != GOT_OBJ_TYPE_BLOB)
 		return 0;
 	err = got_object_open(&obj2, repo, &id2);
 	if (err != NULL || obj2 == NULL)
 		return 0;
-	if (obj2->type != GOT_OBJ_TYPE_BLOB)
+	if (got_object_get_type(obj2) != GOT_OBJ_TYPE_BLOB)
 		return 0;
 
 	err = got_object_blob_open(&blob1, repo, obj1, 512);
@@ -318,12 +318,12 @@ repo_diff_tree(const char *repo_path)
 	err = got_object_open(&obj1, repo, &id1);
 	if (err != NULL || obj1 == NULL)
 		return 0;
-	if (obj1->type != GOT_OBJ_TYPE_TREE)
+	if (got_object_get_type(obj1) != GOT_OBJ_TYPE_TREE)
 		return 0;
 	err = got_object_open(&obj2, repo, &id2);
 	if (err != NULL || obj2 == NULL)
 		return 0;
-	if (obj2->type != GOT_OBJ_TYPE_TREE)
+	if (got_object_get_type(obj2) != GOT_OBJ_TYPE_TREE)
 		return 0;
 
 	err = got_object_tree_open(&tree1, repo, obj1);