Commit Diff


commit - 062ebb78e3657390fb91a2324b2d3a5d2ee07a5b
commit + ccfe88e6ed61166face3636161962cb7c852e047
blob - 34624017c79b7a30d72aa532073224e79b3fcf78
blob + 32270432dac649cd4c71e64449d7fe089a499a8e
--- got/Makefile
+++ got/Makefile
@@ -18,6 +18,7 @@ DEBUG = -O0 -g
 .endif
 CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
 #CPLAGS += -DGOT_PACK_NO_MMAP
+#CFLAGS += -DGOT_NO_OBJ_CACHE
 
 # For now, default to installing binary in ~/bin
 GROUP!=id -g -n
blob - c0e12e9125c2e8f5f4361f2c2dca7bda35222a0c
blob + 4cda42e4375329eac05ec2c3dd673bd79dd9661f
--- lib/repository.c
+++ lib/repository.c
@@ -149,6 +149,7 @@ done:
 
 }
 
+#ifndef GOT_NO_OBJ_CACHE
 static const struct got_error *
 cache_add(struct got_object_cache *cache, struct got_object_id *id, void *item)
 {
@@ -191,6 +192,7 @@ cache_add(struct got_object_cache *cache, struct got_o
 		ce->data.commit = (struct got_commit_object *)item;
 		break;
 	}
+
 	err = got_object_idcache_add(cache->idcache, id, ce);
 	if (err) {
 		if (err->code == GOT_ERR_OBJ_EXISTS) {
@@ -198,21 +200,21 @@ cache_add(struct got_object_cache *cache, struct got_o
 			err = NULL;
 		}
 	}
-
 	return err;
 }
+#endif
 
 const struct got_error *
 got_repo_cache_object(struct got_repository *repo, struct got_object_id *id,
     struct got_object *obj)
 {
+#ifndef GOT_NO_OBJ_CACHE
 	const struct got_error *err = NULL;
-
 	err = cache_add(&repo->objcache, id, obj);
 	if (err)
 		return err;
-
 	obj->refcnt++;
+#endif
 	return NULL;
 }
 
@@ -236,13 +238,13 @@ const struct got_error *
 got_repo_cache_tree(struct got_repository *repo, struct got_object_id *id,
     struct got_tree_object *tree)
 {
+#ifndef GOT_NO_OBJ_CACHE
 	const struct got_error *err = NULL;
-
 	err = cache_add(&repo->treecache, id, tree);
 	if (err)
 		return err;
-
 	tree->refcnt++;
+#endif
 	return NULL;
 }
 
@@ -266,13 +268,14 @@ const struct got_error *
 got_repo_cache_commit(struct got_repository *repo, struct got_object_id *id,
     struct got_commit_object *commit)
 {
+#ifndef GOT_NO_OBJ_CACHE
 	const struct got_error *err = NULL;
-
 	err = cache_add(&repo->commitcache, id, commit);
 	if (err)
 		return err;
 
 	commit->refcnt++;
+#endif
 	return NULL;
 }
 
blob - 5c429a7ec6ecc0e5e3229fa40e747a5071499c03
blob + 42b06ff5a56203d601f0b4921e63d9137a6e6a5a
--- regress/repository/Makefile
+++ regress/repository/Makefile
@@ -10,6 +10,7 @@ LDADD = -lutil -lz
 DEBUG = -O0 -g
 CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
 #CFLAGS += -DGOT_PACK_NO_MMAP
+#CFLAGS += -DGOT_NO_OBJ_CACHE
 
 NOMAN = yes
 
blob - f8c274e725508881d9373433bb656d1dfb801112
blob + 9d0e62fd9a44e3ffd0196775424715a6dddb143d
--- regress/worktree/Makefile
+++ regress/worktree/Makefile
@@ -10,6 +10,7 @@ LDADD = -lutil -lz
 DEBUG = -O0 -g
 CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
 #CFLAGS += -DGOT_PACK_NO_MMAP
+#CFLAGS += -DGOT_NO_OBJ_CACHE
 
 NOMAN = yes
 
blob - dbaa942edff0f3aeff645f149e86fb18cc6d4ab8
blob + ae193fbfc152808ed0547ee38cad186538963737
--- tog/Makefile
+++ tog/Makefile
@@ -18,6 +18,7 @@ DEBUG = -O0 -g
 .endif
 CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
 #CPLAGS += -DGOT_PACK_NO_MMAP
+#CFLAGS += -DGOT_NO_OBJ_CACHE
 
 # For now, default to installing binary in ~/bin
 GROUP!=id -g -n