]> git.proxmox.com Git - libgit2.git/commit - src/libgit2/repository.c
Allow for caching of submodules.
authorBrock Peabody <bpeabody@twosigma.com>
Wed, 23 Nov 2016 23:32:48 +0000 (18:32 -0500)
committerDavid Turner <dturner@twosigma.com>
Fri, 20 Jan 2017 22:33:56 +0000 (17:33 -0500)
commit4d99c4cfc604bb141fd4e1423e934ebd3fb7e2a7
tree7fa6287b0ecfb6873dfd74eaf819cff1cf396bc2
parentca05857e71f8d11582b1ad82f63c6a61e96fe20e
Allow for caching of submodules.

Added `git_repository_submodule_cache_all` to initialze a cache of
submodules on the repository so that operations looking up N
submodules are O(N) and not O(N^2).  Added a
`git_repository_submodule_cache_clear` function to remove the cache.

Also optimized the function that loads all submodules as it was itself
O(N^2) w.r.t the number of submodules, having to loop through the
`.gitmodules` file once per submodule.  I changed it to process the
`.gitmodules` file once, into a map.

Signed-off-by: David Turner <dturner@twosigma.com>
include/git2/sys/repository.h
src/repository.c
src/repository.h
src/submodule.c
src/submodule.h
tests/submodule/lookup.c