summaryrefslogtreecommitdiff
path: root/src/iterator.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-11-06 16:16:46 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-11-07 08:33:27 +0100
commit62a617dc683c1e73eebd0e1b6209f76748e67ed4 (patch)
tree5893fe2b801d96825582d8a461b50e80f4a2a43a /src/iterator.h
parentf1a7906fdf0657fba88449bdab07237847f36670 (diff)
downloadlibgit2-cmn/submodule-and-dir.tar.gz
iterator: submodules are determined by an index or treecmn/submodule-and-dir
We cannot know from looking at .gitmodules whether a directory is a submodule or not. We need the index or tree we are comparing against to tell us. Otherwise we have to assume the entry in .gitmodules is stale or otherwise invalid. Thus we pass the index of the repository into the workdir iterator, even if we do not want to compare against it. This follows what git does, which even for `git diff <tree>`, it will consider staged submodules as such.
Diffstat (limited to 'src/iterator.h')
-rw-r--r--src/iterator.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/iterator.h b/src/iterator.h
index d88ad5191..1520bffc2 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -86,6 +86,8 @@ extern int git_iterator_for_workdir_ext(
git_iterator **out,
git_repository *repo,
const char *repo_workdir,
+ git_index *index,
+ git_tree *tree,
git_iterator_flag_t flags,
const char *start,
const char *end);
@@ -96,11 +98,13 @@ extern int git_iterator_for_workdir_ext(
GIT_INLINE(int) git_iterator_for_workdir(
git_iterator **out,
git_repository *repo,
+ git_index *index,
+ git_tree *tree,
git_iterator_flag_t flags,
const char *start,
const char *end)
{
- return git_iterator_for_workdir_ext(out, repo, NULL, flags, start, end);
+ return git_iterator_for_workdir_ext(out, repo, NULL, index, tree, flags, start, end);
}
/* for filesystem iterators, you have to explicitly pass in the ignore_case