summaryrefslogtreecommitdiff
path: root/src/stash.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-07-28 11:41:27 -0500
committerEdward Thomson <ethomson@microsoft.com>2015-08-28 18:39:47 -0400
commited1c64464a4e3126eef5d74d2c14c19133fa9cd8 (patch)
tree8105397838d42450ae6bd38efe4479cf377eee7b /src/stash.c
parent126932eb0b3986784915acb4fab8f4137d162651 (diff)
downloadlibgit2-ed1c64464a4e3126eef5d74d2c14c19133fa9cd8.tar.gz
iterator: use an options struct instead of args
Diffstat (limited to 'src/stash.c')
-rw-r--r--src/stash.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/stash.c b/src/stash.c
index fcb1112ac..35824659a 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -679,12 +679,14 @@ static int merge_indexes(
git_index *theirs_index)
{
git_iterator *ancestor = NULL, *ours = NULL, *theirs = NULL;
- const git_iterator_flag_t flags = GIT_ITERATOR_DONT_IGNORE_CASE;
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
int error;
- if ((error = git_iterator_for_tree(&ancestor, ancestor_tree, flags, NULL, NULL)) < 0 ||
- (error = git_iterator_for_index(&ours, ours_index, flags, NULL, NULL)) < 0 ||
- (error = git_iterator_for_index(&theirs, theirs_index, flags, NULL, NULL)) < 0)
+ iter_opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
+
+ if ((error = git_iterator_for_tree(&ancestor, ancestor_tree, &iter_opts)) < 0 ||
+ (error = git_iterator_for_index(&ours, ours_index, &iter_opts)) < 0 ||
+ (error = git_iterator_for_index(&theirs, theirs_index, &iter_opts)) < 0)
goto done;
error = git_merge__iterators(out, repo, ancestor, ours, theirs, NULL);
@@ -704,12 +706,14 @@ static int merge_index_and_tree(
git_tree *theirs_tree)
{
git_iterator *ancestor = NULL, *ours = NULL, *theirs = NULL;
- const git_iterator_flag_t flags = GIT_ITERATOR_DONT_IGNORE_CASE;
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
int error;
- if ((error = git_iterator_for_tree(&ancestor, ancestor_tree, flags, NULL, NULL)) < 0 ||
- (error = git_iterator_for_index(&ours, ours_index, flags, NULL, NULL)) < 0 ||
- (error = git_iterator_for_tree(&theirs, theirs_tree, flags, NULL, NULL)) < 0)
+ iter_opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
+
+ if ((error = git_iterator_for_tree(&ancestor, ancestor_tree, &iter_opts)) < 0 ||
+ (error = git_iterator_for_index(&ours, ours_index, &iter_opts)) < 0 ||
+ (error = git_iterator_for_tree(&theirs, theirs_tree, &iter_opts)) < 0)
goto done;
error = git_merge__iterators(out, repo, ancestor, ours, theirs, NULL);
@@ -797,14 +801,15 @@ static int stage_new_files(
git_tree *tree)
{
git_iterator *iterators[2] = { NULL, NULL };
+ git_iterator_options iterator_options = GIT_ITERATOR_OPTIONS_INIT;
git_index *index = NULL;
int error;
if ((error = git_index_new(&index)) < 0 ||
- (error = git_iterator_for_tree(&iterators[0], parent_tree,
- GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
- (error = git_iterator_for_tree(&iterators[1], tree,
- GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0)
+ (error = git_iterator_for_tree(
+ &iterators[0], parent_tree, &iterator_options)) < 0 ||
+ (error = git_iterator_for_tree(
+ &iterators[1], tree, &iterator_options)) < 0)
goto done;
error = git_iterator_walk(iterators, 2, stage_new_file, index);