Fix bug in diff untracked dir scan When scanning untracked directories looking for non-ignored files there was a bug where an empty directory would generate a false error.
diff --git a/src/diff.c b/src/diff.c
index 6336016..3846a5e 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -786,10 +786,15 @@ static int diff_scan_inside_untracked_dir(
/* need to recurse into non-ignored directories */
if (!is_ignored && S_ISDIR(info->nitem->mode)) {
- if ((error = git_iterator_advance_into(
- &info->nitem, info->new_iter)) < 0)
- break;
- continue;
+ error = git_iterator_advance_into(&info->nitem, info->new_iter);
+
+ if (!error)
+ continue;
+ else if (error == GIT_ENOTFOUND) {
+ error = 0;
+ is_ignored = true; /* treat empty as ignored */
+ } else
+ break; /* real error, must stop */
}
/* found a non-ignored item - treat parent dir as untracked */