diff options
author | Russell Belfer <rb@github.com> | 2014-04-23 16:28:45 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-23 16:28:45 -0700 |
commit | 219c89d19d7e18a336faa094b0c29cb7bb0d22c6 (patch) | |
tree | 7b92ff71719817db7dfce3378b5b90b2170f7e80 /src/iterator.h | |
parent | 37da368545b28157e625212e8009ec041cc4a4ea (diff) | |
download | libgit2-219c89d19d7e18a336faa094b0c29cb7bb0d22c6.tar.gz |
Treat ignored, empty, and untracked dirs different
In the iterator, distinguish between ignores and empty directories
so that diff and status can ignore empty directories, but checkout
and stash can treat them as untracked items.
Diffstat (limited to 'src/iterator.h')
-rw-r--r-- | src/iterator.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/iterator.h b/src/iterator.h index dcedbd530..ba9c1e486 100644 --- a/src/iterator.h +++ b/src/iterator.h @@ -258,12 +258,23 @@ extern int git_iterator_current_workdir_path( /* Return index pointer if index iterator, else NULL */ extern git_index *git_iterator_get_index(git_iterator *iter); -/* Special type of advance that can be called when looking at a tree in - * the working directory that leaves the iterator on the next item after - * the tree, but also scans the tree contents looking for any items that - * are not ignored. +typedef enum { + GIT_ITERATOR_STATUS_NORMAL = 0, + GIT_ITERATOR_STATUS_IGNORED = 1, + GIT_ITERATOR_STATUS_EMPTY = 2 +} git_iterator_status_t; + +/* Advance over a directory and check if it contains no files or just + * ignored files. + * + * In a tree or the index, all directories will contain files, but in the + * working directory it is possible to have an empty directory tree or a + * tree that only contains ignored files. Many Git operations treat these + * cases specially. This advances over a directory (presumably an + * untracked directory) but checks during the scan if there are any files + * and any non-ignored files. */ -extern int git_iterator_advance_over_and_check_ignored( - const git_index_entry **entry, bool *ignored, git_iterator *iter); +extern int git_iterator_advance_over_with_status( + const git_index_entry **entry, git_iterator_status_t *status, git_iterator *iter); #endif |