summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-05 16:10:05 -0800
committerRussell Belfer <rb@github.com>2013-03-06 16:52:01 -0800
commit169dc61607b69726c6012ab70758692637928a85 (patch)
tree01593b00741391d9c9d6aad6344aed4cbc8ef6a4 /src/index.c
parented4f95e5d9f2f59dc5d5a4b76a696b0595b6175d (diff)
downloadlibgit2-169dc61607b69726c6012ab70758692637928a85.tar.gz
Make iterator APIs consistent with standards
The iterator APIs are not currently consistent with the parameter ordering of the rest of the codebase. This rearranges the order of parameters, simplifies the naming of a number of functions, and makes somewhat better use of macros internally to clean up the iterator code. This also expands the test coverage of iterator functionality, making sure that case sensitive range-limited iteration works correctly.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/index.c b/src/index.c
index 4deafd77f..1ca3b16b2 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1679,54 +1679,3 @@ git_repository *git_index_owner(const git_index *index)
{
return INDEX_OWNER(index);
}
-
-int git_index_read_tree_match(
- git_index *index, git_tree *tree, git_strarray *strspec)
-{
-#if 0
- git_iterator *iter = NULL;
- const git_index_entry *entry;
- char *pfx = NULL;
- git_vector pathspec = GIT_VECTOR_INIT;
- git_pool pathpool = GIT_POOL_INIT_STRINGPOOL;
-#endif
-
- if (!git_pathspec_is_interesting(strspec))
- return git_index_read_tree(index, tree);
-
- return git_index_read_tree(index, tree);
-
-#if 0
- /* The following loads the matches into the index, but doesn't
- * erase obsoleted entries (e.g. you load a blob at "a/b" which
- * should obsolete a blob at "a/b/c/d" since b is no longer a tree)
- */
-
- if (git_pathspec_init(&pathspec, strspec, &pathpool) < 0)
- return -1;
-
- pfx = git_pathspec_prefix(strspec);
-
- if ((error = git_iterator_for_tree_range(&iter, tree, pfx, pfx)) < 0 ||
- (error = git_iterator_current(iter, &entry)) < 0)
- goto cleanup;
-
- while (entry != NULL) {
- if (git_pathspec_match_path(
- &pathspec, entry->path, false, false, NULL) &&
- (error = git_index_add(index, entry)) < 0)
- goto cleanup;
-
- if ((error = git_iterator_advance(iter, &entry)) < 0)
- goto cleanup;
- }
-
-cleanup:
- git_iterator_free(iter);
- git_pathspec_free(&pathspec);
- git_pool_clear(&pathpool);
- git__free(pfx);
-
- return error;
-#endif
-}