diff options
author | Alan Rogers <alan@github.com> | 2014-05-21 22:54:34 +1000 |
---|---|---|
committer | Alan Rogers <alan@github.com> | 2014-05-21 22:54:34 +1000 |
commit | 86c9d3dae2561405ec98506e6e72bf845c8315c1 (patch) | |
tree | 5ebc08854a55ec991cd3c2f662db32a2b60c92c8 /src/diff.c | |
parent | 61bef72dc35c593e632dc2008c4eec271a264869 (diff) | |
download | libgit2-86c9d3dae2561405ec98506e6e72bf845c8315c1.tar.gz |
Return GIT_FILEMODE_UNREADABLE for files that fail to stat.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/diff.c b/src/diff.c index 32573a270..c169bdacd 100644 --- a/src/diff.c +++ b/src/diff.c @@ -937,22 +937,17 @@ static int handle_unmatched_new_item( if (recurse_into_dir) { error = git_iterator_advance_into(&info->nitem, info->new_iter); - printf("error advancing into diff %d\n", error); - if (error == GIT_EUNREADABLE) { - delta_type = GIT_DELTA_UNREADABLE; - } else { - /* if real error or no error, proceed with iteration */ - if (error != GIT_ENOTFOUND) - return error; - giterr_clear(); + /* if real error or no error, proceed with iteration */ + if (error != GIT_ENOTFOUND) + return error; + giterr_clear(); - /* if directory is empty, can't advance into it, so either skip - * it or ignore it - */ - if (contains_oitem ) - return git_iterator_advance(&info->nitem, info->new_iter); - delta_type = GIT_DELTA_IGNORED; - } + /* if directory is empty, can't advance into it, so either skip + * it or ignore it + */ + if (contains_oitem ) + return git_iterator_advance(&info->nitem, info->new_iter); + delta_type = GIT_DELTA_IGNORED; } } @@ -998,8 +993,12 @@ static int handle_unmatched_new_item( } } + else if (nitem->mode == GIT_FILEMODE_UNREADABLE) { + delta_type = GIT_DELTA_UNREADABLE; + } + /* Actually create the record for this item if necessary */ - if (error != GIT_EUNREADABLE && (error = diff_delta__from_one(diff, delta_type, nitem)) != 0) + if ((error = diff_delta__from_one(diff, delta_type, nitem)) != 0) return error; /* If user requested TYPECHANGE records, then check for that instead of |