|
|
|
@ -817,10 +817,6 @@ public class RecursiveMergerTest extends RepositoryTestCase {
|
|
|
|
|
|
|
|
|
|
void modifyWorktree(WorktreeState worktreeState, String path, String other) |
|
|
|
|
throws Exception { |
|
|
|
|
FileOutputStream fos = null; |
|
|
|
|
ObjectId bloblId; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
switch (worktreeState) { |
|
|
|
|
case Missing: |
|
|
|
|
new File(db.getWorkTree(), path).delete(); |
|
|
|
@ -830,14 +826,17 @@ public class RecursiveMergerTest extends RepositoryTestCase {
|
|
|
|
|
Integer.toString(counter++)); |
|
|
|
|
break; |
|
|
|
|
case SameAsHead: |
|
|
|
|
bloblId = contentId(Constants.HEAD, path); |
|
|
|
|
fos = new FileOutputStream(new File(db.getWorkTree(), path)); |
|
|
|
|
db.newObjectReader().open(bloblId).copyTo(fos); |
|
|
|
|
try (FileOutputStream fos = new FileOutputStream( |
|
|
|
|
new File(db.getWorkTree(), path))) { |
|
|
|
|
db.newObjectReader().open(contentId(Constants.HEAD, path)) |
|
|
|
|
.copyTo(fos); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case SameAsOther: |
|
|
|
|
bloblId = contentId(other, path); |
|
|
|
|
fos = new FileOutputStream(new File(db.getWorkTree(), path)); |
|
|
|
|
db.newObjectReader().open(bloblId).copyTo(fos); |
|
|
|
|
try (FileOutputStream fos = new FileOutputStream( |
|
|
|
|
new File(db.getWorkTree(), path))) { |
|
|
|
|
db.newObjectReader().open(contentId(other, path)).copyTo(fos); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case Bare: |
|
|
|
|
if (db.isBare()) |
|
|
|
@ -848,10 +847,6 @@ public class RecursiveMergerTest extends RepositoryTestCase {
|
|
|
|
|
db = new FileRepository(new File(workTreeFile, "test.git")); |
|
|
|
|
db_t = new TestRepository<>(db); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
if (fos != null) |
|
|
|
|
fos.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean validateStates(IndexState indexState, |
|
|
|
|