summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-01-08 15:53:13 -0800
committerRussell Belfer <rb@github.com>2013-01-15 09:51:34 -0800
commit134d8c918c3430b19b75f45b1e490ce2aae526ff (patch)
tree73c79fc8d49d494c49e2fe034f3e30d167f7326e /src/checkout.c
parent5c8bb98ce9c4e5bb6527c8ffc274c8b3e0755fa7 (diff)
downloadlibgit2-134d8c918c3430b19b75f45b1e490ce2aae526ff.tar.gz
Update iterator API with flags for ignore_case
This changes the iterator API so that flags can be passed in to the constructor functions to control the ignore_case behavior. At this point, the flags are not supported on tree iterators (i.e. there is no functional change over the old API), but the API changes are all made to accomodate this. By the way, I went with a flags parameter because in the future I have a couple of other ideas for iterator flags that will make it easier to fix some diff/status/checkout bugs.
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/checkout.c b/src/checkout.c
index d5a471d0c..411bf3be7 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -224,7 +224,7 @@ static int checkout_action_wd_only(
if (!git_pathspec_match_path(
pathspec, wd->path,
(data->strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH) != 0,
- workdir->ignore_case))
+ git_iterator_ignore_case(workdir)))
return 0;
/* check if item is tracked in the index but not in the checkout diff */
@@ -1130,7 +1130,7 @@ static int checkout_data_init(
if ((error = git_config_refresh(cfg)) < 0)
goto cleanup;
- if (git_iterator_inner_type(target) == GIT_ITERATOR_INDEX) {
+ if (git_iterator_inner_type(target) == GIT_ITERATOR_TYPE_INDEX) {
/* if we are iterating over the index, don't reload */
data->index = git_iterator_index_get_index(target);
GIT_REFCOUNT_INC(data->index);
@@ -1208,6 +1208,7 @@ int git_checkout_iterator(
git_diff_options diff_opts = GIT_DIFF_OPTIONS_INIT;
uint32_t *actions = NULL;
size_t *counts = NULL;
+ git_iterator_flag_t iterflags = 0;
/* initialize structures and options */
error = checkout_data_init(&data, target, opts);
@@ -1228,18 +1229,21 @@ int git_checkout_iterator(
diff_opts.pathspec = data.opts.paths;
/* set up iterators */
+
+ iterflags = git_iterator_ignore_case(target) ?
+ GIT_ITERATOR_IGNORE_CASE : GIT_ITERATOR_DONT_IGNORE_CASE;
+
if ((error = git_iterator_reset(target, data.pfx, data.pfx)) < 0 ||
(error = git_iterator_for_workdir_range(
- &workdir, data.repo, data.pfx, data.pfx)) < 0 ||
+ &workdir, data.repo, iterflags, data.pfx, data.pfx)) < 0 ||
(error = git_iterator_for_tree_range(
- &baseline, data.opts.baseline, data.pfx, data.pfx)) < 0)
+ &baseline, data.opts.baseline, iterflags, data.pfx, data.pfx)) < 0)
goto cleanup;
/* Handle case insensitivity for baseline if necessary */
- if (workdir->ignore_case && !baseline->ignore_case) {
+ if (git_iterator_ignore_case(workdir) != git_iterator_ignore_case(baseline))
if ((error = git_iterator_spoolandsort_push(baseline, true)) < 0)
goto cleanup;
- }
/* Generate baseline-to-target diff which will include an entry for
* every possible update that might need to be made.