Re: [PATCH 7/9] object-store: provide helpers for loose_objects_cache

2018-11-12 Thread Jeff King
On Mon, Nov 12, 2018 at 08:24:59PM +0100, René Scharfe wrote: > > +void odb_load_loose_cache(struct object_directory *odb, int subdir_nr) > > +{ > > + struct strbuf buf = STRBUF_INIT; > > + > > + if (subdir_nr < 0 || > > Why not make subdir_nr unsigned (like in

Re: [PATCH 7/9] object-store: provide helpers for loose_objects_cache

2018-11-12 Thread René Scharfe
Am 12.11.2018 um 15:50 schrieb Jeff King: > --- a/sha1-file.c > +++ b/sha1-file.c > @@ -2125,6 +2125,32 @@ int for_each_loose_object(each_loose_object_fn cb, > void *data, > return 0; > } > > +static int append_loose_object(const struct object_id *oid, const char *path, > +

[PATCH 7/9] object-store: provide helpers for loose_objects_cache

2018-11-12 Thread Jeff King
Our object_directory struct has a loose objects cache that all users of the struct can see. But the only one that knows how to load the cache is find_short_object_filename(). Let's extract that logic in to a reusable function. While we're at it, let's also reset the cache when we re-read the