summaryrefslogtreecommitdiff
path: root/src/iterator.c
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-05-02 09:50:15 -0700
committerVicent Marti <vicent@github.com>2014-05-02 09:50:15 -0700
commit272b462db7cfb50c1ab69e1edda214b21f242ae5 (patch)
tree13c7a7ef6e7ef1e6d90949e60a3d4677ef9096e4 /src/iterator.c
parent9862ef8ef8ffd95a74be8082acab9fea0de85edb (diff)
parent99dfa470398b9c4e06e5a5ee61868d3b9e21b26e (diff)
downloadlibgit2-272b462db7cfb50c1ab69e1edda214b21f242ae5.tar.gz
Merge pull request #2308 from libgit2/rb/diff-update-index-stat-cache
Reduce excessive OID calculation for diff and stat
Diffstat (limited to 'src/iterator.c')
-rw-r--r--src/iterator.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/iterator.c b/src/iterator.c
index ef27fa71f..4f8087c8d 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -1016,6 +1016,7 @@ static int fs_iterator__expand_dir(fs_iterator *fi)
fs_iterator__free_frame(ff);
return GIT_ENOTFOUND;
}
+ fi->base.stat_calls += ff->entries.length;
fs_iterator__seek_frame_start(fi, ff);
@@ -1304,9 +1305,10 @@ static int workdir_iterator__enter_dir(fs_iterator *fi)
/* convert submodules to GITLINK and remove trailing slashes */
git_vector_foreach(&ff->entries, pos, entry) {
- if (S_ISDIR(entry->st.st_mode) &&
- git_submodule__is_submodule(fi->base.repo, entry->path))
- {
+ if (!S_ISDIR(entry->st.st_mode) || !strcmp(GIT_DIR, entry->path))
+ continue;
+
+ if (git_submodule__is_submodule(fi->base.repo, entry->path)) {
entry->st.st_mode = GIT_FILEMODE_COMMIT;
entry->path_len--;
entry->path[entry->path_len] = '\0';