Commit f47bc8ff5e844fec15e705e8ebd11bae742b8039

Alan Rogers 2014-05-20T18:16:04

Skip unreadable files for now.

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 ?