Commit 673dff88 by Brock Peabody Committed by David Turner

Skip submodule head/index update when caching.

`git_submodule_status` is very slow, bottlenecked on
`git_repository_head_tree`, which it uses through `submodule_update_head`.  If
the user has requested submodule caching, assume that they want this status
cached too and skip it.

Signed-off-by: David Turner <dturner@twosigma.com>
parent 4d99c4cf
...@@ -1544,13 +1544,22 @@ int git_submodule__status( ...@@ -1544,13 +1544,22 @@ int git_submodule__status(
return 0; return 0;
} }
/* refresh the index OID */ /* If the user has requested caching submodule state, performing these
if (submodule_update_index(sm) < 0) * expensive operations (especially `submodule_update_head`, which is
return -1; * bottlenecked on `git_repository_head_tree`) eliminates much of the
* advantage. We will, therefore, interpret the request for caching to
* apply here to and skip them.
*/
/* refresh the HEAD OID */ if (sm->repo->submodule_cache == NULL) {
if (submodule_update_head(sm) < 0) /* refresh the index OID */
return -1; if (submodule_update_index(sm) < 0)
return -1;
/* refresh the HEAD OID */
if (submodule_update_head(sm) < 0)
return -1;
}
/* for ignore == dirty, don't scan the working directory */ /* for ignore == dirty, don't scan the working directory */
if (ign == GIT_SUBMODULE_IGNORE_DIRTY) { if (ign == GIT_SUBMODULE_IGNORE_DIRTY) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment