summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Rogers <alan@github.com>2014-05-22 19:43:58 +1000
committerAlan Rogers <alan@github.com>2014-05-22 19:43:58 +1000
commite8cc3032c1ef50cebd138705025bf292dd41a717 (patch)
treec979cc0e75dcfa49b2735d7642fa1cb5c232bb59
parent6580b11c2a6694d929271817005b23abb0551d43 (diff)
downloadlibgit2-e8cc3032c1ef50cebd138705025bf292dd41a717.tar.gz
Return GIT_DELTA_UNREADABLE for a file with a mode change
-rw-r--r--src/diff.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c
index 6da983eae..db22e5ee3 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -747,6 +747,11 @@ static int maybe_modified(
else if (GIT_MODE_TYPE(omode) != GIT_MODE_TYPE(nmode)) {
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_INCLUDE_TYPECHANGE))
status = GIT_DELTA_TYPECHANGE;
+ else if (nmode == GIT_FILEMODE_UNREADABLE) {
+ if (!(error = diff_delta__from_one(diff, GIT_DELTA_DELETED, oitem)))
+ error = diff_delta__from_one(diff, GIT_DELTA_UNREADABLE, nitem);
+ return error;
+ }
else {
if (!(error = diff_delta__from_one(diff, GIT_DELTA_DELETED, oitem)))
error = diff_delta__from_one(diff, GIT_DELTA_ADDED, nitem);