diff options
| author | Edward Thomson <ethomson@github.com> | 2016-03-10 00:04:26 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-03-23 17:16:37 -0400 |
| commit | 0e0589fcc383a0ca96d342896103e01d715df755 (patch) | |
| tree | 90e0518ec567eade47a5ed4e6c07e9edb94162f6 /src/checkout.c | |
| parent | d051de243c28be01525d1bb2f2e716fd000892d8 (diff) | |
| download | libgit2-0e0589fcc383a0ca96d342896103e01d715df755.tar.gz | |
iterator: combine fs+workdir iterators more completely
Drop some of the layers of indirection between the workdir and the
filesystem iterators. This makes the code a little bit easier to
follow, and reduces the number of unnecessary allocations a bit as
well. (Prior to this, when we filter entries, we would allocate them,
filter them and then free them; now we do the filtering before
allocation.)
Also, rename `git_iterator_advance_over_with_status` to just
`git_iterator_advance_over`. Mostly because it's a fucking long-ass
function name otherwise.
Diffstat (limited to 'src/checkout.c')
| -rw-r--r-- | src/checkout.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/checkout.c b/src/checkout.c index bf3de2ece..0fbb7fc16 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -394,7 +394,7 @@ static int checkout_action_wd_only( git_buf_sets(&data->tmp, wd->path); saved_wd.path = data->tmp.ptr; - error = git_iterator_advance_over_with_status( + error = git_iterator_advance_over( wditem, &untracked_state, workdir); if (error == GIT_ITEROVER) over = true; @@ -930,7 +930,7 @@ static int checkout_conflicts_load(checkout_data *data, git_iterator *workdir, g git_index *index; /* Only write conficts from sources that have them: indexes. */ - if ((index = git_iterator_get_index(data->target)) == NULL) + if ((index = git_iterator_index(data->target)) == NULL) return 0; data->update_conflicts._cmp = checkout_conflictdata_cmp; @@ -1080,7 +1080,7 @@ static int checkout_conflicts_coalesce_renames( size_t i, names; int error = 0; - if ((index = git_iterator_get_index(data->target)) == NULL) + if ((index = git_iterator_index(data->target)) == NULL) return 0; /* Juggle entries based on renames */ @@ -1138,7 +1138,7 @@ static int checkout_conflicts_mark_directoryfile( const char *path; int prefixed, error = 0; - if ((index = git_iterator_get_index(data->target)) == NULL) + if ((index = git_iterator_index(data->target)) == NULL) return 0; len = git_index_entrycount(index); @@ -2378,7 +2378,7 @@ static int checkout_data_init( if ((error = git_repository_index(&data->index, data->repo)) < 0) goto cleanup; - if (data->index != git_iterator_get_index(target)) { + if (data->index != git_iterator_index(target)) { if ((error = git_index_read(data->index, true)) < 0) goto cleanup; @@ -2600,7 +2600,7 @@ int git_checkout_iterator( (error = checkout_create_conflicts(&data)) < 0) goto cleanup; - if (data.index != git_iterator_get_index(target) && + if (data.index != git_iterator_index(target) && (error = checkout_extensions_update_index(&data)) < 0) goto cleanup; |
