diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-08-27 15:09:07 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-08-27 15:09:07 +0200 |
| commit | 6a0d2b43ee4a32b2894d3c2b7c798c4eb4853534 (patch) | |
| tree | a7fedcd3bffe2d021e31491b4f1f020c1bea8f88 /src/diff.c | |
| parent | 8733993599d9d9a8fe1b042a1e18d6ecb9b0a0b2 (diff) | |
| parent | cb92467bc284b87c38cdf32f8803a528846d094b (diff) | |
| download | libgit2-6a0d2b43ee4a32b2894d3c2b7c798c4eb4853534.tar.gz | |
Merge remote-tracking branch 'upstream/master' into cmn/ssh-retry
Diffstat (limited to 'src/diff.c')
| -rw-r--r-- | src/diff.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c index 325c599e0..2691d7ca0 100644 --- a/src/diff.c +++ b/src/diff.c @@ -92,6 +92,10 @@ static int diff_delta__from_one( if (status == GIT_DELTA_UNTRACKED && DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNTRACKED)) return 0; + + if (status == GIT_DELTA_UNREADABLE && + DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNREADABLE)) + return 0; if (!git_pathspec__match( &diff->pathspec, entry->path, @@ -196,6 +200,7 @@ static git_diff_delta *diff_delta__last_for_item( if (git_oid__cmp(&delta->new_file.id, &item->id) == 0) return delta; break; + case GIT_DELTA_UNREADABLE: case GIT_DELTA_UNTRACKED: if (diff->strcomp(delta->new_file.path, item->path) == 0 && git_oid__cmp(&delta->new_file.id, &item->id) == 0) @@ -293,6 +298,10 @@ bool git_diff_delta__should_skip( (flags & GIT_DIFF_INCLUDE_UNTRACKED) == 0) return true; + if (delta->status == GIT_DELTA_UNREADABLE && + (flags & GIT_DIFF_INCLUDE_UNREADABLE) == 0) + return true; + return false; } @@ -734,6 +743,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); @@ -954,6 +968,13 @@ static int handle_unmatched_new_item( } } + else if (nitem->mode == GIT_FILEMODE_UNREADABLE) { + if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED)) + delta_type = GIT_DELTA_UNTRACKED; + else + delta_type = GIT_DELTA_UNREADABLE; + } + /* Actually create the record for this item if necessary */ if ((error = diff_delta__from_one(diff, delta_type, nitem)) != 0) return error; |
