|
|
@@ -58,6 +58,7 @@ import java.io.FileOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
import java.time.Instant; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
import org.eclipse.jgit.junit.RepositoryTestCase; |
|
|
|
import org.eclipse.jgit.lib.Constants; |
|
|
@@ -93,12 +94,17 @@ public class OpenSshConfigTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
|
|
|
|
private void config(String data) throws IOException { |
|
|
|
FS fs = db.getFS(); |
|
|
|
FS fs = FS.DETECTED; |
|
|
|
long resolution = FS.getFileStoreAttributes(configFile.toPath()) |
|
|
|
.getFsTimestampResolution().toNanos(); |
|
|
|
Instant lastMtime = fs.lastModifiedInstant(configFile); |
|
|
|
do { |
|
|
|
try (final OutputStreamWriter fw = new OutputStreamWriter( |
|
|
|
new FileOutputStream(configFile), UTF_8)) { |
|
|
|
fw.write(data); |
|
|
|
TimeUnit.NANOSECONDS.sleep(resolution); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
Thread.interrupted(); |
|
|
|
} |
|
|
|
} while (lastMtime.equals(fs.lastModifiedInstant(configFile))); |
|
|
|
} |