Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-01-03 05:01:34 +0400
committerRussell Belfer <rb@github.com>2013-01-05 03:47:43 +0400
commit546d65a8dae8a7af7288163a580c08c827ebda1d (patch)
tree4dd9337f19108bbee970a9c5b1258f94fb7d2270 /src/iterator.c
parenta9a730075eee70444db4ab4bbb928c29a812bbbf (diff)
Fix up spoolandsort iterator usage
The spoolandsort iterator changes got sort-of cherry picked out of this branch and so I dropped the commit when rebasing; however, there were a few small changes that got dropped as well (since the version merged upstream wasn't quite the same as what I dropped).
Diffstat (limited to 'src/iterator.c')
-rw-r--r--src/iterator.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/iterator.c b/src/iterator.c
index b15453400..cf88efffd 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -30,8 +30,8 @@
(P)->base.start = start ? git__strdup(start) : NULL; \
(P)->base.end = end ? git__strdup(end) : NULL; \
(P)->base.ignore_case = false; \
- if ((start && !(P)->base.start) || (end && !(P)->base.end)) \
- return -1; \
+ if ((start && !(P)->base.start) || (end && !(P)->base.end)) { \
+ git__free(P); return -1; } \
} while (0)
static int iterator__reset_range(
@@ -990,31 +990,24 @@ fail:
git_index *git_iterator_index_get_index(git_iterator *iter)
{
- if (iter->type == GIT_ITERATOR_SPOOLANDSORT)
- iter = ((spoolandsort_iterator *)iter)->wrapped;
-
if (iter->type == GIT_ITERATOR_INDEX)
return ((index_iterator *)iter)->index;
+ if (iter->type == GIT_ITERATOR_SPOOLANDSORT &&
+ ((spoolandsort_callbacks *)iter->cb)->orig_type == GIT_ITERATOR_INDEX)
+ return ((index_iterator *)iter)->index;
+
return NULL;
}
git_iterator_type_t git_iterator_inner_type(git_iterator *iter)
{
if (iter->type == GIT_ITERATOR_SPOOLANDSORT)
- iter = ((spoolandsort_iterator *)iter)->wrapped;
+ return ((spoolandsort_callbacks *)iter->cb)->orig_type;
return iter->type;
}
-git_iterator *git_iterator_spoolandsort_inner_iterator(git_iterator *iter)
-{
- if (iter->type == GIT_ITERATOR_SPOOLANDSORT)
- return ((spoolandsort_iterator *)iter)->wrapped;
-
- return NULL;
-}
-
int git_iterator_current_tree_entry(
git_iterator *iter, const git_tree_entry **tree_entry)
{
@@ -1085,8 +1078,8 @@ int git_iterator_advance_into_directory(
if (iter->type == GIT_ITERATOR_WORKDIR &&
wi->entry.path &&
- S_ISDIR(wi->entry.mode) &&
- !S_ISGITLINK(wi->entry.mode))
+ (wi->entry.mode == GIT_FILEMODE_TREE ||
+ wi->entry.mode == GIT_FILEMODE_COMMIT))
{
if (workdir_iterator__expand_dir(wi) < 0)
/* if error loading or if empty, skip the directory. */