Skip unreadable files for now.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
diff --git a/src/diff.c b/src/diff.c
index bc23e6b..a0cfb58 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -925,14 +925,14 @@ static int handle_unmatched_new_item(
error = git_iterator_advance_into(&info->nitem, info->new_iter);
/* if real error or no error, proceed with iteration */
- if (error != GIT_ENOTFOUND)
+ if (error != GIT_ENOTFOUND && error != GIT_EUNREADABLE)
return error;
giterr_clear();
/* if directory is empty, can't advance into it, so either skip
* it or ignore it
*/
- if (contains_oitem)
+ if (contains_oitem && error != GIT_EUNREADABLE)
return git_iterator_advance(&info->nitem, info->new_iter);
delta_type = GIT_DELTA_IGNORED;
}
@@ -981,7 +981,7 @@ static int handle_unmatched_new_item(
}
/* Actually create the record for this item if necessary */
- if ((error = diff_delta__from_one(diff, delta_type, nitem)) != 0)
+ if (error != GIT_EUNREADABLE && (error = diff_delta__from_one(diff, delta_type, nitem)) != 0)
return error;
/* If user requested TYPECHANGE records, then check for that instead of
diff --git a/src/status.c b/src/status.c
index 8d7612f..061c9d5 100644
--- a/src/status.c
+++ b/src/status.c
@@ -329,8 +329,10 @@ int git_status_list_new(
if (show != GIT_STATUS_SHOW_INDEX_ONLY) {
if ((error = git_diff_index_to_workdir(
- &status->idx2wd, repo, index, &diffopt)) < 0)
+ &status->idx2wd, repo, index, &diffopt)) < 0) {
+ printf("git_diff_index_to_workdir failed with error %d\n", error);
goto done;
+ }
if ((flags & GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR) != 0 &&
(error = git_diff_find_similar(status->idx2wd, &findopt)) < 0)
@@ -407,8 +409,10 @@ int git_status_foreach_ext(
size_t i;
int error = 0;
- if ((error = git_status_list_new(&status, repo, opts)) < 0)
+ if ((error = git_status_list_new(&status, repo, opts)) < 0) {
+ printf("git_status_list_new failed with error %d\n", error);
return error;
+ }
git_vector_foreach(&status->paired, i, status_entry) {
const char *path = status_entry->head_to_index ?