mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 01:20:53 +00:00
iterator: drop advance_into_or_over
Now that iterators do not return `GIT_ENOTFOUND` when advancing into an empty directory, we do not need a special `advance_into_or_over` function.
This commit is contained in:
parent
6cd9573f54
commit
0a2e10328a
@ -657,7 +657,7 @@ static int checkout_action(
|
||||
if (cmp == 0) {
|
||||
if (wd->mode == GIT_FILEMODE_TREE) {
|
||||
/* case 2 - entry prefixed by workdir tree */
|
||||
error = git_iterator_advance_into_or_over(wditem, workdir);
|
||||
error = git_iterator_advance_into(wditem, workdir);
|
||||
if (error < 0 && error != GIT_ITEROVER)
|
||||
goto done;
|
||||
continue;
|
||||
|
@ -222,25 +222,6 @@ GIT_INLINE(int) git_iterator_advance_over(
|
||||
return git_iterator_advance(entry, iter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance into a tree or skip over it if it is empty.
|
||||
*
|
||||
* Because `git_iterator_advance_into` may return GIT_ENOTFOUND if the
|
||||
* directory is empty (only with filesystem and working directory
|
||||
* iterators) and a common response is to just call `git_iterator_advance`
|
||||
* when that happens, this bundles the two into a single simple call.
|
||||
*/
|
||||
GIT_INLINE(int) git_iterator_advance_into_or_over(
|
||||
const git_index_entry **entry, git_iterator *iter)
|
||||
{
|
||||
int error = iter->cb->advance_into(entry, iter);
|
||||
if (error == GIT_ENOTFOUND) {
|
||||
giterr_clear();
|
||||
error = iter->cb->advance(entry, iter);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Go back to the start of the iteration.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user