summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-04-23 16:28:45 -0700
committerRussell Belfer <rb@github.com>2014-04-23 16:28:45 -0700
commit219c89d19d7e18a336faa094b0c29cb7bb0d22c6 (patch)
tree7b92ff71719817db7dfce3378b5b90b2170f7e80 /src/diff.c
parent37da368545b28157e625212e8009ec041cc4a4ea (diff)
downloadlibgit2-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/diff.c')
-rw-r--r--src/diff.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/diff.c b/src/diff.c
index f1c1b0543..18cd52c55 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -839,7 +839,7 @@ static int handle_unmatched_new_item(
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS))
{
git_diff_delta *last;
- bool ignored;
+ git_iterator_status_t untracked_state;
/* attempt to insert record for this directory */
if ((error = diff_delta__from_one(diff, delta_type, nitem)) != 0)
@@ -851,13 +851,14 @@ static int handle_unmatched_new_item(
return git_iterator_advance(&info->nitem, info->new_iter);
/* iterate into dir looking for an actual untracked file */
- if ((error = git_iterator_advance_over_and_check_ignored(
- &info->nitem, &ignored, info->new_iter)) < 0 &&
+ if ((error = git_iterator_advance_over_with_status(
+ &info->nitem, &untracked_state, info->new_iter)) < 0 &&
error != GIT_ITEROVER)
return error;
- /* it iteration only found ignored items, update the record */
- if (ignored) {
+ /* if we found nothing or just ignored items, update the record */
+ if (untracked_state == GIT_ITERATOR_STATUS_IGNORED ||
+ untracked_state == GIT_ITERATOR_STATUS_EMPTY) {
last->status = GIT_DELTA_IGNORED;
/* remove the record if we don't want ignored records */