summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Schreiber <schreiber.arthur@googlemail.com>2016-02-11 23:37:52 +0100
committerArthur Schreiber <schreiber.arthur@googlemail.com>2016-02-11 23:41:34 +0100
commit3679ebaef5436a662ad74819f6cbd2c1e76e6766 (patch)
treefac507cf5de7ba022c71c22186236f6e033ed1e8 /src
parent460ae11f0a8178c5d5abc55574dc3e0e312a47ea (diff)
downloadlibgit2-3679ebaef5436a662ad74819f6cbd2c1e76e6766.tar.gz
Horrible fix for #3173.
Diffstat (limited to 'src')
-rw-r--r--src/checkout.c5
-rw-r--r--src/diff.c8
-rw-r--r--src/index.c4
-rw-r--r--src/iterator.c5
-rw-r--r--src/iterator.h1
-rw-r--r--src/merge.c14
-rw-r--r--src/pathspec.c3
-rw-r--r--src/stash.c8
-rw-r--r--src/submodule.c6
9 files changed, 28 insertions, 26 deletions
diff --git a/src/checkout.c b/src/checkout.c
index fd8e2c443..95ce3c9d3 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -2521,7 +2521,8 @@ int git_checkout_iterator(
if (data.opts.baseline_index) {
if ((error = git_iterator_for_index(
- &baseline, data.opts.baseline_index, &baseline_opts)) < 0)
+ &baseline, git_index_owner(data.opts.baseline_index),
+ data.opts.baseline_index, &baseline_opts)) < 0)
goto cleanup;
} else {
if ((error = git_iterator_for_tree(
@@ -2633,7 +2634,7 @@ int git_checkout_index(
return error;
GIT_REFCOUNT_INC(index);
- if (!(error = git_iterator_for_index(&index_i, index, NULL)))
+ if (!(error = git_iterator_for_index(&index_i, repo, index, NULL)))
error = git_checkout_iterator(index_i, index, opts);
if (owned)
diff --git a/src/diff.c b/src/diff.c
index 67fab0763..9ac5b9250 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1371,7 +1371,7 @@ int git_diff_tree_to_index(
DIFF_FROM_ITERATORS(
git_iterator_for_tree(&a, old_tree, &a_opts), iflag,
- git_iterator_for_index(&b, index, &b_opts), iflag
+ git_iterator_for_index(&b, repo, index, &b_opts), iflag
);
/* if index is in case-insensitive order, re-sort deltas to match */
@@ -1395,7 +1395,7 @@ int git_diff_index_to_workdir(
return error;
DIFF_FROM_ITERATORS(
- git_iterator_for_index(&a, index, &a_opts),
+ git_iterator_for_index(&a, repo, index, &a_opts),
GIT_ITERATOR_INCLUDE_CONFLICTS,
git_iterator_for_workdir(&b, repo, index, NULL, &b_opts),
@@ -1472,8 +1472,8 @@ int git_diff_index_to_index(
assert(diff && old_index && new_index);
DIFF_FROM_ITERATORS(
- git_iterator_for_index(&a, old_index, &a_opts), GIT_ITERATOR_DONT_IGNORE_CASE,
- git_iterator_for_index(&b, new_index, &b_opts), GIT_ITERATOR_DONT_IGNORE_CASE
+ git_iterator_for_index(&a, repo, old_index, &a_opts), GIT_ITERATOR_DONT_IGNORE_CASE,
+ git_iterator_for_index(&b, repo, new_index, &b_opts), GIT_ITERATOR_DONT_IGNORE_CASE
);
/* if index is in case-insensitive order, re-sort deltas to match */
diff --git a/src/index.c b/src/index.c
index 081a1ea59..ac4d8eee7 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2907,8 +2907,8 @@ int git_index_read_index(
opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
- if ((error = git_iterator_for_index(&index_iterator, index, &opts)) < 0 ||
- (error = git_iterator_for_index(&new_iterator, (git_index *)new_index, &opts)) < 0)
+ if ((error = git_iterator_for_index(&index_iterator, git_index_owner(index), index, &opts)) < 0 ||
+ (error = git_iterator_for_index(&new_iterator, git_index_owner(new_index), (git_index *)new_index, &opts)) < 0)
goto done;
if (((error = git_iterator_current(&old_entry, index_iterator)) < 0 &&
diff --git a/src/iterator.c b/src/iterator.c
index ee348de6e..04aac3e01 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -1080,6 +1080,7 @@ static void index_iterator__free(git_iterator *self)
int git_iterator_for_index(
git_iterator **iter,
+ git_repository *repo,
git_index *index,
git_iterator_options *options)
{
@@ -1093,7 +1094,7 @@ int git_iterator_for_index(
}
ii->index = index;
- ITERATOR_BASE_INIT(ii, index, INDEX, git_index_owner(index));
+ ITERATOR_BASE_INIT(ii, index, INDEX, repo);
if ((error = iterator__update_ignore_case((git_iterator *)ii, options ? options->flags : 0)) < 0) {
git_iterator_free((git_iterator *)ii);
@@ -2071,7 +2072,7 @@ int git_iterator_advance_over_with_status(
if (!error)
continue;
-
+
else if (error == GIT_ENOTFOUND) {
/* we entered this directory only hoping to find child matches to
* our pathlist (eg, this is `foo` and we had a pathlist entry for
diff --git a/src/iterator.h b/src/iterator.h
index 59f87e9de..ac17d2970 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -95,6 +95,7 @@ extern int git_iterator_for_tree(
*/
extern int git_iterator_for_index(
git_iterator **out,
+ git_repository *repo,
git_index *index,
git_iterator_options *options);
diff --git a/src/merge.c b/src/merge.c
index 70c705af6..d2f92ccce 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -2083,9 +2083,9 @@ static int iterator_for_annotated_commit(
opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
if (commit == NULL) {
- error = git_iterator_for_nothing(out, &opts);
+ error = git_iterator_for_nothing(out, &opts);
} else if (commit->type == GIT_ANNOTATED_COMMIT_VIRTUAL) {
- error = git_iterator_for_index(out, commit->index, &opts);
+ error = git_iterator_for_index(out, git_index_owner(commit->index), commit->index, &opts);
} else {
if (!commit->tree &&
(error = git_commit_tree(&commit->tree, commit->commit)) < 0)
@@ -2427,7 +2427,7 @@ static int write_merge_msg(
assert(repo && heads);
entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
- GITERR_CHECK_ALLOC(entries);
+ GITERR_CHECK_ALLOC(entries);
if (git_vector_init(&matching, heads_len, NULL) < 0) {
git__free(entries);
@@ -2481,7 +2481,7 @@ static int write_merge_msg(
if (matching.length)
sep =',';
-
+
if ((error = merge_msg_entries(&matching, entries, heads_len, msg_entry_is_tag)) < 0 ||
(error = merge_msg_write_tags(&file, &matching, sep)) < 0)
goto cleanup;
@@ -2682,8 +2682,8 @@ static int merge_check_index(size_t *conflicts, git_repository *repo, git_index
iter_opts.pathlist.strings = (char **)staged_paths.contents;
iter_opts.pathlist.count = staged_paths.length;
- if ((error = git_iterator_for_index(&iter_repo, index_repo, &iter_opts)) < 0 ||
- (error = git_iterator_for_index(&iter_new, index_new, &iter_opts)) < 0 ||
+ if ((error = git_iterator_for_index(&iter_repo, repo, index_repo, &iter_opts)) < 0 ||
+ (error = git_iterator_for_index(&iter_new, repo, index_new, &iter_opts)) < 0 ||
(error = git_diff__from_iterators(&index_diff_list, repo, iter_repo, iter_new, &opts)) < 0)
goto done;
@@ -2759,7 +2759,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
if ((error = git_repository_head_tree(&head_tree, repo)) < 0 ||
(error = git_iterator_for_tree(&iter_head, head_tree, &iter_opts)) < 0 ||
- (error = git_iterator_for_index(&iter_new, index_new, &iter_opts)) < 0 ||
+ (error = git_iterator_for_index(&iter_new, repo, index_new, &iter_opts)) < 0 ||
(error = git_diff__from_iterators(&merged_list, repo, iter_head, iter_new, &opts)) < 0)
goto done;
diff --git a/src/pathspec.c b/src/pathspec.c
index 5bb69ec4b..8a93cdd50 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -550,7 +550,7 @@ int git_pathspec_match_index(
iter_opts.flags = pathspec_match_iter_flags(flags);
- if (!(error = git_iterator_for_index(&iter, index, &iter_opts))) {
+ if (!(error = git_iterator_for_index(&iter, git_index_owner(index), index, &iter_opts))) {
error = pathspec_match_from_iterator(out, iter, flags, ps);
git_iterator_free(iter);
}
@@ -718,4 +718,3 @@ const char * git_pathspec_match_list_failed_entry(
return entry ? *entry : NULL;
}
-
diff --git a/src/stash.c b/src/stash.c
index 35824659a..43a464e64 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -685,8 +685,8 @@ static int merge_indexes(
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)
+ (error = git_iterator_for_index(&ours, repo, ours_index, &iter_opts)) < 0 ||
+ (error = git_iterator_for_index(&theirs, repo, theirs_index, &iter_opts)) < 0)
goto done;
error = git_merge__iterators(out, repo, ancestor, ours, theirs, NULL);
@@ -712,7 +712,7 @@ static int merge_index_and_tree(
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(&ours, repo, ours_index, &iter_opts)) < 0 ||
(error = git_iterator_for_tree(&theirs, theirs_tree, &iter_opts)) < 0)
goto done;
@@ -728,7 +728,7 @@ done:
static void normalize_apply_options(
git_stash_apply_options *opts,
const git_stash_apply_options *given_apply_opts)
-{
+{
if (given_apply_opts != NULL) {
memcpy(opts, given_apply_opts, sizeof(git_stash_apply_options));
} else {
diff --git a/src/submodule.c b/src/submodule.c
index 6ec4c53e1..3e55c5676 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -327,7 +327,7 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
const git_index_entry *entry;
git_buf name = GIT_BUF_INIT;
- if ((error = git_iterator_for_index(&i, idx, NULL)) < 0)
+ if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
return error;
while (!(error = git_iterator_advance(&entry, i))) {
@@ -1037,7 +1037,7 @@ static int submodule_repo_create(
/**
* Repodir: path to the sub-repo. sub-repo goes in:
- * <repo-dir>/modules/<name>/ with a gitlink in the
+ * <repo-dir>/modules/<name>/ with a gitlink in the
* sub-repo workdir directory to that repository.
*/
error = git_buf_join3(
@@ -1154,7 +1154,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
clone_options.repository_cb_payload = sm;
/*
- * Do not perform checkout as part of clone, instead we
+ * Do not perform checkout as part of clone, instead we
* will checkout the specific commit manually.
*/
clone_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;