diff options
Diffstat (limited to 'src/checkout.c')
-rw-r--r-- | src/checkout.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/checkout.c b/src/checkout.c index 19ac913d3..68ebbe31d 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -456,7 +456,7 @@ static int checkout_action( while (1) { if (!wd) return checkout_action_no_wd(data, delta); - + cmp = strcomp(wd->path, delta->old_file.path); /* 1. wd before delta ("a/a" before "a/b") @@ -473,9 +473,9 @@ static int checkout_action( if (cmp == 0) { if (wd->mode == GIT_FILEMODE_TREE) { /* case 2 - entry prefixed by workdir tree */ - if (git_iterator_advance_into_directory(workdir, &wd) < 0) + if (git_iterator_advance_into(&wd, workdir) < 0) goto fail; - + *wditem_ptr = wd; continue; } @@ -484,14 +484,14 @@ static int checkout_action( if (delta->old_file.path[strlen(wd->path)] == '/') { act = checkout_action_with_wd_blocker(data, delta, wd); *wditem_ptr = - git_iterator_advance(workdir, &wd) ? NULL : wd; + git_iterator_advance(&wd, workdir) ? NULL : wd; return act; } } /* case 1 - handle wd item (if it matches pathspec) */ if (checkout_action_wd_only(data, workdir, wd, pathspec) < 0 || - git_iterator_advance(workdir, &wd) < 0) + git_iterator_advance(&wd, workdir) < 0) goto fail; *wditem_ptr = wd; @@ -501,7 +501,7 @@ static int checkout_action( if (cmp == 0) { /* case 4 */ act = checkout_action_with_wd(data, delta, wd); - *wditem_ptr = git_iterator_advance(workdir, &wd) ? NULL : wd; + *wditem_ptr = git_iterator_advance(&wd, workdir) ? NULL : wd; return act; } @@ -514,7 +514,7 @@ static int checkout_action( if (delta->status == GIT_DELTA_TYPECHANGE) { if (delta->old_file.mode == GIT_FILEMODE_TREE) { act = checkout_action_with_wd(data, delta, wd); - if (git_iterator_advance_into_directory(workdir, &wd) < 0) + if (git_iterator_advance_into(&wd, workdir) < 0) wd = NULL; *wditem_ptr = wd; return act; @@ -525,7 +525,7 @@ static int checkout_action( delta->old_file.mode == GIT_FILEMODE_COMMIT) { act = checkout_action_with_wd(data, delta, wd); - if (git_iterator_advance(workdir, &wd) < 0) + if (git_iterator_advance(&wd, workdir) < 0) wd = NULL; *wditem_ptr = wd; return act; @@ -554,7 +554,7 @@ static int checkout_remaining_wd_items( while (wd && !error) { if (!(error = checkout_action_wd_only(data, workdir, wd, spec))) - error = git_iterator_advance(workdir, &wd); + error = git_iterator_advance(&wd, workdir); } return error; @@ -578,7 +578,7 @@ static int checkout_get_actions( git_pathspec_init(&pathspec, &data->opts.paths, &pathpool) < 0) return -1; - if ((error = git_iterator_current(workdir, &wditem)) < 0) + if ((error = git_iterator_current(&wditem, workdir)) < 0) goto fail; deltas = &data->diff->deltas; @@ -1134,16 +1134,17 @@ static int checkout_data_init( if ((error = git_config_refresh(cfg)) < 0) goto cleanup; - 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); + /* if we are checking out the index, don't reload, + * otherwise get index and force reload + */ + if ((data->index = git_iterator_get_index(target)) != NULL) { GIT_REFCOUNT_INC(data->index); } else { /* otherwise, grab and reload the index */ if ((error = git_repository_index(&data->index, data->repo)) < 0 || (error = git_index_read(data->index)) < 0) goto cleanup; - + /* clear the REUC when doing a tree or commit checkout */ git_index_reuc_clear(data->index); } @@ -1241,16 +1242,15 @@ int git_checkout_iterator( 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, iterflags, data.pfx, data.pfx)) < 0 || - (error = git_iterator_for_tree_range( + (error = git_iterator_for_workdir( + &workdir, data.repo, iterflags | GIT_ITERATOR_DONT_AUTOEXPAND, + data.pfx, data.pfx)) < 0 || + (error = git_iterator_for_tree( &baseline, data.opts.baseline, iterflags, data.pfx, data.pfx)) < 0) goto cleanup; - /* Handle case insensitivity for baseline if necessary */ - if (git_iterator_ignore_case(workdir) != git_iterator_ignore_case(baseline)) - if ((error = git_iterator_spoolandsort_push(baseline, true)) < 0) - goto cleanup; + /* Should not have case insensitivity mismatch */ + assert(git_iterator_ignore_case(workdir) == git_iterator_ignore_case(baseline)); /* Generate baseline-to-target diff which will include an entry for * every possible update that might need to be made. @@ -1321,7 +1321,7 @@ int git_checkout_index( return error; GIT_REFCOUNT_INC(index); - if (!(error = git_iterator_for_index(&index_i, index))) + if (!(error = git_iterator_for_index(&index_i, index, 0, NULL, NULL))) error = git_checkout_iterator(index_i, opts); git_iterator_free(index_i); @@ -1348,7 +1348,7 @@ int git_checkout_tree( return -1; } - if (!(error = git_iterator_for_tree(&tree_i, tree))) + if (!(error = git_iterator_for_tree(&tree_i, tree, 0, NULL, NULL))) error = git_checkout_iterator(tree_i, opts); git_iterator_free(tree_i); @@ -1369,7 +1369,7 @@ int git_checkout_head( return error; if (!(error = checkout_lookup_head_tree(&head, repo)) && - !(error = git_iterator_for_tree(&head_i, head))) + !(error = git_iterator_for_tree(&head_i, head, 0, NULL, NULL))) error = git_checkout_iterator(head_i, opts); git_iterator_free(head_i); |