On Sat, 3 Mar 2018 18:36:37 +0700 Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote: > The reason callers have to call this is to make sure either packed_git > or packed_git_mru pointers are initialized since we don't do that by > default. Sometimes it's hard to see this connection between where the > function is called and where packed_git pointer is used (sometimes in > separate functions). > > Keep this dependency internal because now all access to packed_git and > packed_git_mru must go through get_xxx() wrappers. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> The patches up to and including this one look good. I also see that the question I asked in patch 10 about lazily initializing some fields is answered here. If we're planning to avoid making the user call prepare_packed_git() (which I agree with), I think we also need to ensure that we always use the get_xxx() wrapper whenever we access objects.packed_git. Currently, there are still some functions in packfile.c that do not do so (notably for_each_packed_object()). Could these be changed too? (This should not be too difficult for you to do on your own, but I can send a fixup patch if you want.)