Merge branch 'stable-6.0'
* stable-6.0: Revert "RefDirectory.scanRef: Re-use file existence check done in snapshot creation" TreeRevFilter: fix wrong stop when the given path disappears Change-Id: Id7540d03991cdcf6f405e946b8cbbcc6a9696a31 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
commit
f77519775d
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.dircache.DirCacheEntry;
|
||||||
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
|
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
|
||||||
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
|
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
|
||||||
import org.eclipse.jgit.treewalk.filter.TreeFilter;
|
import org.eclipse.jgit.treewalk.filter.TreeFilter;
|
||||||
|
@ -253,4 +254,23 @@ public void testStringOfPearls_FilePath3_NoParentRewriting()
|
||||||
assertEquals(0, a.getParentCount());
|
assertEquals(0, a.getParentCount());
|
||||||
assertNull(rw.next());
|
assertNull(rw.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStopWhenPathDisappears() throws Exception {
|
||||||
|
DirCacheEntry file1 = file("src/d1/file1", blob("a"));
|
||||||
|
DirCacheEntry file2 = file("src/d1/file2", blob("a"));
|
||||||
|
DirCacheEntry file3 = file("src/d1/file3", blob("a"));
|
||||||
|
RevCommit a = commit(tree(file1));
|
||||||
|
RevCommit b = commit(tree(file1, file2), a);
|
||||||
|
RevCommit c = commit(tree(file1, file3), a);
|
||||||
|
RevCommit d = commit(tree(file1, file2, file3), b, c);
|
||||||
|
filter("src/d1");
|
||||||
|
markStart(d);
|
||||||
|
rw.setRewriteParents(false);
|
||||||
|
|
||||||
|
assertCommit(d, rw.next());
|
||||||
|
assertCommit(c, rw.next());
|
||||||
|
assertCommit(b, rw.next());
|
||||||
|
assertCommit(a, rw.next());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -420,15 +420,6 @@ public boolean equals(Object obj) {
|
||||||
return equals(other);
|
return equals(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the file exists
|
|
||||||
*
|
|
||||||
* @return true if the file exists
|
|
||||||
*/
|
|
||||||
public boolean fileExists() {
|
|
||||||
return !MISSING_FILEKEY.equals(this.fileKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
|
@ -1092,10 +1092,6 @@ LooseRef scanRef(LooseRef ref, String name) throws IOException {
|
||||||
final int limit = 4096;
|
final int limit = 4096;
|
||||||
final byte[] buf;
|
final byte[] buf;
|
||||||
FileSnapshot otherSnapshot = FileSnapshot.save(path);
|
FileSnapshot otherSnapshot = FileSnapshot.save(path);
|
||||||
if (!otherSnapshot.fileExists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
buf = IO.readSome(path, limit);
|
buf = IO.readSome(path, limit);
|
||||||
} catch (FileNotFoundException noFile) {
|
} catch (FileNotFoundException noFile) {
|
||||||
|
|
|
@ -211,7 +211,10 @@ public boolean include(RevWalk walker, RevCommit c)
|
||||||
// "empty tree root" and thus their history is not relevant.
|
// "empty tree root" and thus their history is not relevant.
|
||||||
// Cut our grandparents to be an empty list.
|
// Cut our grandparents to be an empty list.
|
||||||
//
|
//
|
||||||
pList[i].parents = RevCommit.NO_PARENTS;
|
tw.reset(pList[i].getTree());
|
||||||
|
if (!tw.next()) {
|
||||||
|
pList[i].parents = RevCommit.NO_PARENTS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have an interesting difference relative to this parent.
|
// We have an interesting difference relative to this parent.
|
||||||
|
|
Loading…
Reference in New Issue