aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorJens Baumgart <jens.baumgart@sap.com>2010-07-26 10:18:47 +0200
committerShawn O. Pearce <spearce@spearce.org>2010-07-27 10:00:47 -0700
commitdb82b8d7eb646a2d31f1b4e52ab4a623743192e9 (patch)
treed484fb29139ae3673dfad6930aaefb467ec41977 /org.eclipse.jgit.pgm
parenta00377a7e23dbde315598ee20f61c45d031e159a (diff)
downloadjgit-db82b8d7eb646a2d31f1b4e52ab4a623743192e9.tar.gz
jgit-db82b8d7eb646a2d31f1b4e52ab4a623743192e9.zip
Fix concurrent read / write issue in LockFile on Windows
LockFile.commit fails if another thread concurrently reads the base file. The problem is fixed by retrying the rename operation if it fails. Change-Id: I6bb76ea7f2e6e90e3ddc45f9dd4d69bd1b6fa1eb Bug: 308506 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java2
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java2
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java2
4 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
index 5b75c1b5c5..b8e2a8f6fa 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
@@ -227,7 +227,7 @@ class RebuildCommitGraph extends TextBuiltin {
final ObjectId id = db.resolve(Constants.HEAD);
if (!ObjectId.isId(head) && id != null) {
final LockFile lf;
- lf = new LockFile(new File(db.getDirectory(), Constants.HEAD));
+ lf = new LockFile(new File(db.getDirectory(), Constants.HEAD), db.getFS());
if (!lf.lock())
throw new IOException(MessageFormat.format(CLIText.get().cannotLock, Constants.HEAD));
lf.write(id);
@@ -254,7 +254,7 @@ class RebuildCommitGraph extends TextBuiltin {
protected void writeFile(final String name, final byte[] content)
throws IOException {
final File file = new File(db.getDirectory(), name);
- final LockFile lck = new LockFile(file);
+ final LockFile lck = new LockFile(file, db.getFS());
if (!lck.lock())
throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
try {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java
index a99e0abca2..84859a805c 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java
@@ -98,7 +98,7 @@ class Iplog extends TextBuiltin {
if (output != null) {
if (!output.getParentFile().exists())
output.getParentFile().mkdirs();
- LockFile lf = new LockFile(output);
+ LockFile lf = new LockFile(output, db.getFS());
if (!lf.lock())
throw die(MessageFormat.format(CLIText.get().cannotLock, output));
try {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
index b563f07910..6653209a65 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
@@ -94,6 +94,6 @@ class Ipzilla extends TextBuiltin {
output = new File(db.getWorkTree(), IpLogMeta.IPLOG_CONFIG_FILE);
IpLogMeta meta = new IpLogMeta();
- meta.syncCQs(output, ipzilla, username, password);
+ meta.syncCQs(output, db.getFS(), ipzilla, username, password);
}
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
index 01981600dd..712698200e 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
@@ -103,7 +103,7 @@ public class AbstractTreeIteratorHandler extends
if (new File(name).isFile()) {
final DirCache dirc;
try {
- dirc = DirCache.read(new File(name));
+ dirc = DirCache.read(new File(name), FS.DETECTED);
} catch (IOException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e);
}