|
|
@ -581,14 +581,13 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { |
|
|
|
RefUpdate updateRef = db.updateRef("refs/heads/master"); |
|
|
|
RefUpdate updateRef = db.updateRef("refs/heads/master"); |
|
|
|
updateRef.setNewObjectId(pid); |
|
|
|
updateRef.setNewObjectId(pid); |
|
|
|
LockFile lockFile1 = new LockFile(new File(db.getDirectory(), |
|
|
|
LockFile lockFile1 = new LockFile(new File(db.getDirectory(), |
|
|
|
"refs/heads/master"), db.getFS()); |
|
|
|
"refs/heads/master")); |
|
|
|
try { |
|
|
|
try { |
|
|
|
assertTrue(lockFile1.lock()); // precondition to test
|
|
|
|
assertTrue(lockFile1.lock()); // precondition to test
|
|
|
|
Result update = updateRef.update(); |
|
|
|
Result update = updateRef.update(); |
|
|
|
assertEquals(Result.LOCK_FAILURE, update); |
|
|
|
assertEquals(Result.LOCK_FAILURE, update); |
|
|
|
assertEquals(opid, db.resolve("refs/heads/master")); |
|
|
|
assertEquals(opid, db.resolve("refs/heads/master")); |
|
|
|
LockFile lockFile2 = new LockFile(new File(db.getDirectory(),"refs/heads/master"), |
|
|
|
LockFile lockFile2 = new LockFile(new File(db.getDirectory(),"refs/heads/master")); |
|
|
|
db.getFS()); |
|
|
|
|
|
|
|
assertFalse(lockFile2.lock()); // was locked, still is
|
|
|
|
assertFalse(lockFile2.lock()); // was locked, still is
|
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
lockFile1.unlock(); |
|
|
|
lockFile1.unlock(); |
|
|
@ -731,8 +730,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { |
|
|
|
"logs/" + fromName).exists()); |
|
|
|
"logs/" + fromName).exists()); |
|
|
|
|
|
|
|
|
|
|
|
// "someone" has branch X locked
|
|
|
|
// "someone" has branch X locked
|
|
|
|
LockFile lockFile = new LockFile(new File(db.getDirectory(), toLock), |
|
|
|
LockFile lockFile = new LockFile(new File(db.getDirectory(), toLock)); |
|
|
|
db.getFS()); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
assertTrue(lockFile.lock()); |
|
|
|
assertTrue(lockFile.lock()); |
|
|
|
|
|
|
|
|
|
|
|