commit - 6869fb7f545fc78d8a162ffca98601d0c69e21bb
commit + 79c99a64af2fcd11a3c60a54f989167ef4a72310
blob - ea6e03a4134e235d11a7516f27e1f0cf978162ad
blob + 21b84dec550e11df0837e1b7f9dc20217e2463d3
--- include/got_error.h
+++ include/got_error.h
#define GOT_ERR_DIR_NOT_EMPTY 75
#define GOT_ERR_COMMIT_NO_CHANGES 76
#define GOT_ERR_BRANCH_MOVED 77
+#define GOT_ERR_OBJ_TOO_LARGE 78
static const struct got_error {
int code;
{ GOT_ERR_COMMIT_NO_CHANGES, "no changes to commit" },
{ GOT_ERR_BRANCH_MOVED, "work tree's branch reference has moved; "
"new branch reference or rebase required" },
+ { GOT_ERR_OBJ_TOO_LARGE, "object too large" },
};
/*
blob - 5c1d8d2b63a844a8451233a1009e6677e4303090
blob + 0c1a60f2dfc20f83db4ea8e080052c0f16e340b3
--- lib/object_cache.c
+++ lib/object_cache.c
free(id_str);
#endif
cache->cache_toolarge++;
- return NULL;
+ return got_error(GOT_ERR_OBJ_TOO_LARGE);
}
nelem = got_object_idset_num_elements(cache->idset);
}
err = got_object_idset_add(cache->idset, id, ce);
- if (err) {
- if (err->code == GOT_ERR_OBJ_EXISTS) {
- free(ce);
- err = NULL;
- }
- }
+ if (err)
+ free(ce);
return err;
}
blob - bff89f510415a95da98401388298562dac05a804
blob + 0277a4437dc809ba033a7083ce7d917e0a36fd81
--- lib/repository.c
+++ lib/repository.c
#ifndef GOT_NO_OBJ_CACHE
const struct got_error *err = NULL;
err = got_object_cache_add(&repo->objcache, id, obj);
- if (err)
+ if (err) {
+ if (err->code == GOT_ERR_OBJ_EXISTS ||
+ err->code == GOT_ERR_OBJ_TOO_LARGE)
+ err = NULL;
return err;
+ }
obj->refcnt++;
#endif
return NULL;
#ifndef GOT_NO_OBJ_CACHE
const struct got_error *err = NULL;
err = got_object_cache_add(&repo->treecache, id, tree);
- if (err)
+ if (err) {
+ if (err->code == GOT_ERR_OBJ_EXISTS ||
+ err->code == GOT_ERR_OBJ_TOO_LARGE)
+ err = NULL;
return err;
+ }
tree->refcnt++;
#endif
return NULL;
#ifndef GOT_NO_OBJ_CACHE
const struct got_error *err = NULL;
err = got_object_cache_add(&repo->commitcache, id, commit);
- if (err)
+ if (err) {
+ if (err->code == GOT_ERR_OBJ_EXISTS ||
+ err->code == GOT_ERR_OBJ_TOO_LARGE)
+ err = NULL;
return err;
+ }
commit->refcnt++;
#endif
return NULL;
#ifndef GOT_NO_OBJ_CACHE
const struct got_error *err = NULL;
err = got_object_cache_add(&repo->tagcache, id, tag);
- if (err)
+ if (err) {
+ if (err->code == GOT_ERR_OBJ_EXISTS ||
+ err->code == GOT_ERR_OBJ_TOO_LARGE)
+ err = NULL;
return err;
+ }
tag->refcnt++;
#endif
return NULL;
blob - 842624ebb2ee709ad0c8eb682903fbb6fc8824d8
blob + 0f2d28db038b3e3cd5606510cf1f7f5007f8881a
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
(*obj)->refcnt++;
err = got_object_cache_add(objcache, id, *obj);
- if (err)
+ if (err) {
+ if (err->code == GOT_ERR_OBJ_EXISTS ||
+ err->code == GOT_ERR_OBJ_TOO_LARGE)
+ err = NULL;
return err;
+ }
(*obj)->refcnt++;
-
return NULL;
}