2 3b339b2f 2018-02-12 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
4 7b19e0f1 2017-11-05 stsp * Permission to use, copy, modify, and distribute this software for any
5 7b19e0f1 2017-11-05 stsp * purpose with or without fee is hereby granted, provided that the above
6 7b19e0f1 2017-11-05 stsp * copyright notice and this permission notice appear in all copies.
8 7b19e0f1 2017-11-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 7b19e0f1 2017-11-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 7b19e0f1 2017-11-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 7b19e0f1 2017-11-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 7b19e0f1 2017-11-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 7b19e0f1 2017-11-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 7b19e0f1 2017-11-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 79b11c62 2018-03-09 stsp #include <sys/queue.h>
18 deeca238 2018-03-12 stsp #include <sys/stat.h>
20 4027f31a 2017-11-04 stsp #include <limits.h>
21 4027f31a 2017-11-04 stsp #include <stdlib.h>
22 4027f31a 2017-11-04 stsp #include <stdio.h>
23 4027f31a 2017-11-04 stsp #include <sha1.h>
24 4027f31a 2017-11-04 stsp #include <string.h>
25 79b11c62 2018-03-09 stsp #include <zlib.h>
27 4027f31a 2017-11-04 stsp #include "got_error.h"
28 5261c201 2018-04-01 stsp #include "got_reference.h"
29 4027f31a 2017-11-04 stsp #include "got_repository.h"
30 442a3ddc 2018-04-23 stsp #include "got_worktree.h"
31 7bb0daa1 2018-06-21 stsp #include "got_object.h"
33 718b3ab0 2018-03-17 stsp #include "got_lib_path.h"
34 718b3ab0 2018-03-17 stsp #include "got_lib_delta.h"
35 63581804 2018-07-09 stsp #include "got_lib_inflate.h"
36 718b3ab0 2018-03-17 stsp #include "got_lib_object.h"
37 718b3ab0 2018-03-17 stsp #include "got_lib_pack.h"
38 718b3ab0 2018-03-17 stsp #include "got_lib_repository.h"
39 442a3ddc 2018-04-23 stsp #include "got_lib_worktree.h"
40 eb77ee11 2018-07-08 stsp #include "got_lib_object_idcache.h"
42 79b11c62 2018-03-09 stsp #ifndef nitems
43 79b11c62 2018-03-09 stsp #define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
46 4027f31a 2017-11-04 stsp #define GOT_GIT_DIR ".git"
48 4027f31a 2017-11-04 stsp /* Mandatory files and directories inside the git directory. */
49 4df642d9 2017-11-05 stsp #define GOT_OBJECTS_DIR "objects"
50 4df642d9 2017-11-05 stsp #define GOT_REFS_DIR "refs"
51 4df642d9 2017-11-05 stsp #define GOT_HEAD_FILE "HEAD"
53 a1fd68d8 2018-01-12 stsp /* Other files and directories inside the git directory. */
54 4df642d9 2017-11-05 stsp #define GOT_FETCH_HEAD_FILE "FETCH_HEAD"
55 4df642d9 2017-11-05 stsp #define GOT_ORIG_HEAD_FILE "ORIG_HEAD"
56 a1fd68d8 2018-01-12 stsp #define GOT_OBJECTS_PACK_DIR "objects/pack"
59 86c3caaf 2018-03-09 stsp got_repo_get_path(struct got_repository *repo)
61 86c3caaf 2018-03-09 stsp return strdup(repo->path);
65 11995603 2017-11-05 stsp got_repo_get_path_git_dir(struct got_repository *repo)
67 4986b9d5 2018-03-12 stsp return strdup(repo->path_git_dir);
70 4027f31a 2017-11-04 stsp static char *
71 4027f31a 2017-11-04 stsp get_path_git_child(struct got_repository *repo, const char *basename)
73 4027f31a 2017-11-04 stsp char *path_child;
75 4986b9d5 2018-03-12 stsp if (asprintf(&path_child, "%s/%s", repo->path_git_dir,
76 4027f31a 2017-11-04 stsp basename) == -1)
77 4027f31a 2017-11-04 stsp return NULL;
79 4027f31a 2017-11-04 stsp return path_child;
83 11995603 2017-11-05 stsp got_repo_get_path_objects(struct got_repository *repo)
85 4027f31a 2017-11-04 stsp return get_path_git_child(repo, GOT_OBJECTS_DIR);
89 a1fd68d8 2018-01-12 stsp got_repo_get_path_objects_pack(struct got_repository *repo)
91 a1fd68d8 2018-01-12 stsp return get_path_git_child(repo, GOT_OBJECTS_PACK_DIR);
95 11995603 2017-11-05 stsp got_repo_get_path_refs(struct got_repository *repo)
97 4027f31a 2017-11-04 stsp return get_path_git_child(repo, GOT_REFS_DIR);
100 4027f31a 2017-11-04 stsp static char *
101 4027f31a 2017-11-04 stsp get_path_head(struct got_repository *repo)
103 4027f31a 2017-11-04 stsp return get_path_git_child(repo, GOT_HEAD_FILE);
107 4027f31a 2017-11-04 stsp is_git_repo(struct got_repository *repo)
109 11995603 2017-11-05 stsp char *path_git = got_repo_get_path_git_dir(repo);
110 11995603 2017-11-05 stsp char *path_objects = got_repo_get_path_objects(repo);
111 11995603 2017-11-05 stsp char *path_refs = got_repo_get_path_refs(repo);
112 4027f31a 2017-11-04 stsp char *path_head = get_path_head(repo);
113 deeca238 2018-03-12 stsp int ret = 0;
114 deeca238 2018-03-12 stsp struct stat sb;
115 4847cca1 2018-03-12 stsp struct got_reference *head_ref;
117 deeca238 2018-03-12 stsp if (lstat(path_git, &sb) == -1)
119 deeca238 2018-03-12 stsp if (!S_ISDIR(sb.st_mode))
122 deeca238 2018-03-12 stsp if (lstat(path_objects, &sb) == -1)
124 deeca238 2018-03-12 stsp if (!S_ISDIR(sb.st_mode))
127 deeca238 2018-03-12 stsp if (lstat(path_refs, &sb) == -1)
129 deeca238 2018-03-12 stsp if (!S_ISDIR(sb.st_mode))
132 deeca238 2018-03-12 stsp if (lstat(path_head, &sb) == -1)
134 deeca238 2018-03-12 stsp if (!S_ISREG(sb.st_mode))
137 4847cca1 2018-03-12 stsp /* Check if the HEAD reference can be opened. */
138 4847cca1 2018-03-12 stsp if (got_ref_open(&head_ref, repo, GOT_REF_HEAD) != NULL)
140 4847cca1 2018-03-12 stsp got_ref_close(head_ref);
144 4027f31a 2017-11-04 stsp free(path_git);
145 4027f31a 2017-11-04 stsp free(path_objects);
146 4027f31a 2017-11-04 stsp free(path_refs);
147 4027f31a 2017-11-04 stsp free(path_head);
148 4027f31a 2017-11-04 stsp return ret;
152 ccfe88e6 2018-07-12 stsp #ifndef GOT_NO_OBJ_CACHE
153 f6be5c30 2018-06-22 stsp static const struct got_error *
154 f6be5c30 2018-06-22 stsp cache_add(struct got_object_cache *cache, struct got_object_id *id, void *item)
156 50bc349d 2018-06-22 stsp const struct got_error *err = NULL;
157 54f20211 2018-06-22 stsp struct got_object_cache_entry *ce;
160 eb77ee11 2018-07-08 stsp nelem = got_object_idcache_num_elements(cache->idcache);
161 4307e577 2018-06-22 stsp if (nelem >= cache->size) {
162 eb77ee11 2018-07-08 stsp err = got_object_idcache_remove_least_used((void **)&ce,
163 eb77ee11 2018-07-08 stsp cache->idcache);
165 50bc349d 2018-06-22 stsp return err;
166 f6be5c30 2018-06-22 stsp switch (cache->type) {
167 f6be5c30 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_OBJ:
168 f6be5c30 2018-06-22 stsp got_object_close(ce->data.obj);
170 f6be5c30 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_TREE:
171 f6be5c30 2018-06-22 stsp got_object_tree_close(ce->data.tree);
173 1943de01 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_COMMIT:
174 1943de01 2018-06-22 stsp got_object_commit_close(ce->data.commit);
180 7bb0daa1 2018-06-21 stsp ce = calloc(1, sizeof(*ce));
181 7bb0daa1 2018-06-21 stsp if (ce == NULL)
182 7bb0daa1 2018-06-21 stsp return got_error_from_errno();
183 7bb0daa1 2018-06-21 stsp memcpy(&ce->id, id, sizeof(ce->id));
184 f6be5c30 2018-06-22 stsp switch (cache->type) {
185 f6be5c30 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_OBJ:
186 f6be5c30 2018-06-22 stsp ce->data.obj = (struct got_object *)item;
188 f6be5c30 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_TREE:
189 f6be5c30 2018-06-22 stsp ce->data.tree = (struct got_tree_object *)item;
191 1943de01 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_COMMIT:
192 1943de01 2018-06-22 stsp ce->data.commit = (struct got_commit_object *)item;
196 eb77ee11 2018-07-08 stsp err = got_object_idcache_add(cache->idcache, id, ce);
198 50bc349d 2018-06-22 stsp if (err->code == GOT_ERR_OBJ_EXISTS) {
200 50bc349d 2018-06-22 stsp err = NULL;
203 50bc349d 2018-06-22 stsp return err;
207 f6be5c30 2018-06-22 stsp const struct got_error *
208 f6be5c30 2018-06-22 stsp got_repo_cache_object(struct got_repository *repo, struct got_object_id *id,
209 f6be5c30 2018-06-22 stsp struct got_object *obj)
211 ccfe88e6 2018-07-12 stsp #ifndef GOT_NO_OBJ_CACHE
212 f6be5c30 2018-06-22 stsp const struct got_error *err = NULL;
213 f6be5c30 2018-06-22 stsp err = cache_add(&repo->objcache, id, obj);
215 f6be5c30 2018-06-22 stsp return err;
216 f6be5c30 2018-06-22 stsp obj->refcnt++;
218 f6be5c30 2018-06-22 stsp return NULL;
221 7bb0daa1 2018-06-21 stsp struct got_object *
222 7bb0daa1 2018-06-21 stsp got_repo_get_cached_object(struct got_repository *repo,
223 7bb0daa1 2018-06-21 stsp struct got_object_id *id)
225 54f20211 2018-06-22 stsp struct got_object_cache_entry *ce;
227 eb77ee11 2018-07-08 stsp ce = got_object_idcache_get(repo->objcache.idcache, id);
229 54f20211 2018-06-22 stsp repo->objcache.cache_hit++;
230 f6be5c30 2018-06-22 stsp return ce->data.obj;
233 54f20211 2018-06-22 stsp repo->objcache.cache_miss++;
234 7bb0daa1 2018-06-21 stsp return NULL;
237 4027f31a 2017-11-04 stsp const struct got_error *
238 f6be5c30 2018-06-22 stsp got_repo_cache_tree(struct got_repository *repo, struct got_object_id *id,
239 f6be5c30 2018-06-22 stsp struct got_tree_object *tree)
241 ccfe88e6 2018-07-12 stsp #ifndef GOT_NO_OBJ_CACHE
242 f6be5c30 2018-06-22 stsp const struct got_error *err = NULL;
243 f6be5c30 2018-06-22 stsp err = cache_add(&repo->treecache, id, tree);
245 f6be5c30 2018-06-22 stsp return err;
246 f6be5c30 2018-06-22 stsp tree->refcnt++;
248 f6be5c30 2018-06-22 stsp return NULL;
251 f6be5c30 2018-06-22 stsp struct got_tree_object *
252 f6be5c30 2018-06-22 stsp got_repo_get_cached_tree(struct got_repository *repo,
253 f6be5c30 2018-06-22 stsp struct got_object_id *id)
255 f6be5c30 2018-06-22 stsp struct got_object_cache_entry *ce;
257 eb77ee11 2018-07-08 stsp ce = got_object_idcache_get(repo->treecache.idcache, id);
259 f6be5c30 2018-06-22 stsp repo->treecache.cache_hit++;
260 f6be5c30 2018-06-22 stsp return ce->data.tree;
263 f6be5c30 2018-06-22 stsp repo->treecache.cache_miss++;
264 1943de01 2018-06-22 stsp return NULL;
267 1943de01 2018-06-22 stsp const struct got_error *
268 1943de01 2018-06-22 stsp got_repo_cache_commit(struct got_repository *repo, struct got_object_id *id,
269 1943de01 2018-06-22 stsp struct got_commit_object *commit)
271 ccfe88e6 2018-07-12 stsp #ifndef GOT_NO_OBJ_CACHE
272 1943de01 2018-06-22 stsp const struct got_error *err = NULL;
273 1943de01 2018-06-22 stsp err = cache_add(&repo->commitcache, id, commit);
275 1943de01 2018-06-22 stsp return err;
277 1943de01 2018-06-22 stsp commit->refcnt++;
279 f6be5c30 2018-06-22 stsp return NULL;
282 1943de01 2018-06-22 stsp struct got_commit_object *
283 1943de01 2018-06-22 stsp got_repo_get_cached_commit(struct got_repository *repo,
284 1943de01 2018-06-22 stsp struct got_object_id *id)
286 1943de01 2018-06-22 stsp struct got_object_cache_entry *ce;
288 eb77ee11 2018-07-08 stsp ce = got_object_idcache_get(repo->commitcache.idcache, id);
290 1943de01 2018-06-22 stsp repo->commitcache.cache_hit++;
291 1943de01 2018-06-22 stsp return ce->data.commit;
294 1943de01 2018-06-22 stsp repo->commitcache.cache_miss++;
295 1943de01 2018-06-22 stsp return NULL;
298 f6be5c30 2018-06-22 stsp const struct got_error *
299 92af5469 2017-11-05 stsp got_repo_open(struct got_repository **ret, const char *path)
301 92af5469 2017-11-05 stsp struct got_repository *repo = NULL;
302 92af5469 2017-11-05 stsp const struct got_error *err = NULL;
303 2393f13b 2018-03-09 stsp char *abspath;
305 2393f13b 2018-03-09 stsp if (got_path_is_absolute(path))
306 2393f13b 2018-03-09 stsp abspath = strdup(path);
308 2393f13b 2018-03-09 stsp abspath = got_path_get_absolute(path);
309 92af5469 2017-11-05 stsp if (abspath == NULL)
310 92af5469 2017-11-05 stsp return got_error(GOT_ERR_BAD_PATH);
312 4027f31a 2017-11-04 stsp repo = calloc(1, sizeof(*repo));
313 92af5469 2017-11-05 stsp if (repo == NULL) {
314 0a585a0d 2018-03-17 stsp err = got_error_from_errno();
318 f6be5c30 2018-06-22 stsp repo->objcache.type = GOT_OBJECT_CACHE_TYPE_OBJ;
319 4307e577 2018-06-22 stsp repo->objcache.size = GOT_OBJECT_CACHE_SIZE_OBJ;
320 eb77ee11 2018-07-08 stsp repo->objcache.idcache = got_object_idcache_alloc(repo->objcache.size);
321 eb77ee11 2018-07-08 stsp if (repo->objcache.idcache == NULL) {
322 f6be5c30 2018-06-22 stsp err = got_error_from_errno();
326 f6be5c30 2018-06-22 stsp repo->treecache.type = GOT_OBJECT_CACHE_TYPE_TREE;
327 4307e577 2018-06-22 stsp repo->treecache.size = GOT_OBJECT_CACHE_SIZE_TREE;
328 eb77ee11 2018-07-08 stsp repo->treecache.idcache =
329 eb77ee11 2018-07-08 stsp got_object_idcache_alloc(repo->treecache.size);
330 eb77ee11 2018-07-08 stsp if (repo->treecache.idcache == NULL) {
331 1943de01 2018-06-22 stsp err = got_error_from_errno();
335 1943de01 2018-06-22 stsp repo->commitcache.type = GOT_OBJECT_CACHE_TYPE_COMMIT;
336 4307e577 2018-06-22 stsp repo->commitcache.size = GOT_OBJECT_CACHE_SIZE_COMMIT;
337 eb77ee11 2018-07-08 stsp repo->commitcache.idcache =
338 eb77ee11 2018-07-08 stsp got_object_idcache_alloc(repo->commitcache.size);
339 eb77ee11 2018-07-08 stsp if (repo->commitcache.idcache == NULL) {
340 eb77ee11 2018-07-08 stsp err = got_error_from_errno();
344 4027f31a 2017-11-04 stsp repo->path = got_path_normalize(abspath);
345 92af5469 2017-11-05 stsp if (repo->path == NULL) {
346 92af5469 2017-11-05 stsp err = got_error(GOT_ERR_BAD_PATH);
350 4986b9d5 2018-03-12 stsp repo->path_git_dir = strdup(repo->path);
351 4986b9d5 2018-03-12 stsp if (repo->path_git_dir == NULL) {
352 0a585a0d 2018-03-17 stsp err = got_error_from_errno();
355 4986b9d5 2018-03-12 stsp if (!is_git_repo(repo)) {
356 4986b9d5 2018-03-12 stsp free(repo->path_git_dir);
357 4986b9d5 2018-03-12 stsp if (asprintf(&repo->path_git_dir, "%s/%s", repo->path,
358 4986b9d5 2018-03-12 stsp GOT_GIT_DIR) == -1) {
359 0a585a0d 2018-03-17 stsp err = got_error_from_errno();
362 4986b9d5 2018-03-12 stsp if (!is_git_repo(repo)) {
363 442a3ddc 2018-04-23 stsp struct got_worktree *worktree;
364 442a3ddc 2018-04-23 stsp if (got_worktree_open(&worktree, repo->path) == NULL) {
365 442a3ddc 2018-04-23 stsp free(repo->path_git_dir);
366 442a3ddc 2018-04-23 stsp repo->path_git_dir =
367 442a3ddc 2018-04-23 stsp strdup(worktree->repo_path);
368 442a3ddc 2018-04-23 stsp if (repo->path_git_dir == NULL) {
369 442a3ddc 2018-04-23 stsp err = got_error_from_errno();
372 442a3ddc 2018-04-23 stsp if (!is_git_repo(repo)) {
373 442a3ddc 2018-04-23 stsp free(repo->path_git_dir);
374 442a3ddc 2018-04-23 stsp if (asprintf(&repo->path_git_dir,
375 442a3ddc 2018-04-23 stsp "%s/%s", worktree->repo_path,
376 442a3ddc 2018-04-23 stsp GOT_GIT_DIR) == -1) {
377 442a3ddc 2018-04-23 stsp err = got_error_from_errno();
381 442a3ddc 2018-04-23 stsp got_worktree_close(worktree);
384 442a3ddc 2018-04-23 stsp if (!is_git_repo(repo)) {
385 4986b9d5 2018-03-12 stsp err = got_error(GOT_ERR_NOT_GIT_REPO);
390 4027f31a 2017-11-04 stsp *ret = repo;
393 4986b9d5 2018-03-12 stsp got_repo_close(repo);
394 92af5469 2017-11-05 stsp free(abspath);
395 92af5469 2017-11-05 stsp return err;
399 1943de01 2018-06-22 stsp static void
400 1943de01 2018-06-22 stsp print_cache_stats(struct got_object_cache *cache, const char *name)
402 1943de01 2018-06-22 stsp fprintf(stderr, "%s cache: %d elements, %d hits, %d missed\n",
403 eb77ee11 2018-07-08 stsp name, got_object_idcache_num_elements(cache->idcache),
404 eb77ee11 2018-07-08 stsp cache->cache_hit, cache->cache_miss);
407 cd717821 2018-06-22 stsp void check_refcount(struct got_object_id *id, void *data, void *arg)
409 cd717821 2018-06-22 stsp struct got_object_cache *cache = arg;
410 cd717821 2018-06-22 stsp struct got_object_cache_entry *ce = data;
411 cd717821 2018-06-22 stsp struct got_object *obj;
412 cd717821 2018-06-22 stsp struct got_tree_object *tree;
413 cd717821 2018-06-22 stsp struct got_commit_object *commit;
414 cd717821 2018-06-22 stsp char *id_str;
416 cd717821 2018-06-22 stsp if (got_object_id_str(&id_str, id) != NULL)
419 cd717821 2018-06-22 stsp switch (cache->type) {
420 cd717821 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_OBJ:
421 cd717821 2018-06-22 stsp obj = ce->data.obj;
422 cd717821 2018-06-22 stsp if (obj->refcnt == 1)
424 cd717821 2018-06-22 stsp fprintf(stderr, "object %s has %d unclaimed references\n",
425 cd717821 2018-06-22 stsp id_str, obj->refcnt - 1);
427 cd717821 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_TREE:
428 cd717821 2018-06-22 stsp tree = ce->data.tree;
429 cd717821 2018-06-22 stsp if (tree->refcnt == 1)
431 cd717821 2018-06-22 stsp fprintf(stderr, "tree %s has %d unclaimed references\n",
432 cd717821 2018-06-22 stsp id_str, tree->refcnt - 1);
434 cd717821 2018-06-22 stsp case GOT_OBJECT_CACHE_TYPE_COMMIT:
435 cd717821 2018-06-22 stsp commit = ce->data.commit;
436 cd717821 2018-06-22 stsp if (commit->refcnt == 1)
438 cd717821 2018-06-22 stsp fprintf(stderr, "commit %s has %d unclaimed references\n",
439 cd717821 2018-06-22 stsp id_str, commit->refcnt);
442 cd717821 2018-06-22 stsp free(id_str);
447 4027f31a 2017-11-04 stsp got_repo_close(struct got_repository *repo)
451 65cf1e80 2018-03-16 stsp for (i = 0; i < nitems(repo->packidx_cache); i++) {
452 65cf1e80 2018-03-16 stsp if (repo->packidx_cache[i] == NULL)
454 65cf1e80 2018-03-16 stsp got_packidx_close(repo->packidx_cache[i]);
457 7e656b93 2018-03-17 stsp for (i = 0; i < nitems(repo->packs); i++) {
458 7e656b93 2018-03-17 stsp if (repo->packs[i].path_packfile == NULL)
460 7e656b93 2018-03-17 stsp got_pack_close(&repo->packs[i]);
463 4027f31a 2017-11-04 stsp free(repo->path);
464 4986b9d5 2018-03-12 stsp free(repo->path_git_dir);
467 1943de01 2018-06-22 stsp print_cache_stats(&repo->objcache, "object");
468 1943de01 2018-06-22 stsp print_cache_stats(&repo->treecache, "tree");
469 1943de01 2018-06-22 stsp print_cache_stats(&repo->commitcache, "commit");
470 eb77ee11 2018-07-08 stsp got_object_idcache_for_each(repo->objcache.idcache, check_refcount,
471 cd717821 2018-06-22 stsp &repo->objcache);
472 eb77ee11 2018-07-08 stsp got_object_idcache_for_each(repo->treecache.idcache, check_refcount,
473 cd717821 2018-06-22 stsp &repo->treecache);
474 eb77ee11 2018-07-08 stsp got_object_idcache_for_each(repo->commitcache.idcache, check_refcount,
475 cd717821 2018-06-22 stsp &repo->commitcache);
478 eb77ee11 2018-07-08 stsp if (repo->objcache.idcache)
479 eb77ee11 2018-07-08 stsp got_object_idcache_free(repo->objcache.idcache);
480 eb77ee11 2018-07-08 stsp if (repo->treecache.idcache)
481 eb77ee11 2018-07-08 stsp got_object_idcache_free(repo->treecache.idcache);
482 eb77ee11 2018-07-08 stsp if (repo->commitcache.idcache)
483 eb77ee11 2018-07-08 stsp got_object_idcache_free(repo->commitcache.idcache);
484 4027f31a 2017-11-04 stsp free(repo);