diff options
author | Russell Belfer <rb@github.com> | 2014-04-22 21:51:54 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-22 21:51:54 -0700 |
commit | 37da368545b28157e625212e8009ec041cc4a4ea (patch) | |
tree | 9fac6b09448e10224191507e764263374ed36083 /src/iterator.h | |
parent | 3c1aa4c110d2d4c8c3d941b0e4ba66357172da2e (diff) | |
download | libgit2-37da368545b28157e625212e8009ec041cc4a4ea.tar.gz |
Make checkout match diff for untracked/ignored dir
When diff finds an untracked directory, it emulates Git behavior
by looking inside the directory to see if there are any untracked
items inside it. If there are only ignored items inside the dir,
then diff considers it ignored, even if there is no direct ignore
rule for it.
Checkout was not copying this behavior - when it found an untracked
directory, it just treated it as untracked. Unfortunately, when
combined with GIT_CHECKOUT_REMOVE_UNTRACKED, this made is seem that
checkout (and stash, which uses checkout) was removing ignored
items when you had only asked it to remove untracked ones.
This commit moves the logic for advancing past an untracked dir
while scanning for non-ignored items into an iterator helper fn,
and uses that for both diff and checkout.
Diffstat (limited to 'src/iterator.h')
-rw-r--r-- | src/iterator.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/iterator.h b/src/iterator.h index 751e139d0..dcedbd530 100644 --- a/src/iterator.h +++ b/src/iterator.h @@ -258,4 +258,12 @@ 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. + */ +extern int git_iterator_advance_over_and_check_ignored( + const git_index_entry **entry, bool *ignored, git_iterator *iter); + #endif |