Skip gitlink modes as we can't get a content difference
A gitlink mode doesn't have a blob file contents, which means we can't get its hunk edit list to store in the cache, and we most certainly can't read its target as though it were a blob with lines. Currently we are reading a 1 line delta on these files coming back from git-diff-tree because git-diff-tree is doing a pretty-printing that looks like this: diff --git a/modules/parser b/modules/parser -Subproject 88dde83e6f7c09e44f5a03420fcff44145d89b2 +Subproject dabca1dfbedb13a105003a8adcbb777fe87883b This is bogus, and not what we want. So jump out early and cache an empty edit list, since there isnt't really a text line being replaced in this path name. Bug: issue 438 Change-Id: I966de5e6623d32201c6bbd42f388c875a8fc209e Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
45442f8782
commit
1ce61dbfbc
@ -38,6 +38,7 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
|||||||
import org.eclipse.jgit.errors.MissingObjectException;
|
import org.eclipse.jgit.errors.MissingObjectException;
|
||||||
import org.eclipse.jgit.lib.AnyObjectId;
|
import org.eclipse.jgit.lib.AnyObjectId;
|
||||||
import org.eclipse.jgit.lib.Constants;
|
import org.eclipse.jgit.lib.Constants;
|
||||||
|
import org.eclipse.jgit.lib.FileMode;
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
import org.eclipse.jgit.lib.ObjectLoader;
|
import org.eclipse.jgit.lib.ObjectLoader;
|
||||||
import org.eclipse.jgit.lib.ObjectWriter;
|
import org.eclipse.jgit.lib.ObjectWriter;
|
||||||
@ -191,6 +192,13 @@ public class PatchListCacheImpl implements PatchListCache {
|
|||||||
return new PatchListEntry(fileHeader, Collections.<Edit> emptyList());
|
return new PatchListEntry(fileHeader, Collections.<Edit> emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final FileMode oldMode = fileHeader.getOldMode();
|
||||||
|
final FileMode newMode = fileHeader.getNewMode();
|
||||||
|
|
||||||
|
if (oldMode == FileMode.GITLINK || newMode == FileMode.GITLINK) {
|
||||||
|
return new PatchListEntry(fileHeader, Collections.<Edit> emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
List<Edit> edits = fileHeader.toEditList();
|
List<Edit> edits = fileHeader.toEditList();
|
||||||
|
|
||||||
// Bypass the longer task of looking for replacement edits if
|
// Bypass the longer task of looking for replacement edits if
|
||||||
|
Loading…
Reference in New Issue
Block a user