diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2011-01-25 23:26:38 +0100 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-01-26 11:26:55 -0600 |
commit | c4c8d80fd3a32cace67e7e42650aae7c46dcc622 (patch) | |
tree | da48f6defbe24b6f9447c2cf59e75cd81a8e0232 /org.eclipse.jgit/src | |
parent | 509662653b43cadaab680b5bd8567747217d24d7 (diff) | |
download | jgit-c4c8d80fd3a32cace67e7e42650aae7c46dcc622.tar.gz jgit-c4c8d80fd3a32cace67e7e42650aae7c46dcc622.zip |
Fix adding files in a network share
We cannot always rename read-only files on network shares,
so rename the temp file for a new loose object first, and
then set it as read-only.
Bug: 335388
Change-Id: Ie0350e032a97e0d09626d6143c5c692873a5f6a2
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java index afad321cb4..ac48d2a4bc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java @@ -472,8 +472,6 @@ public class ObjectDirectory extends FileObjectDatabase { return InsertLooseObjectResult.EXISTS_PACKED; } - tmp.setReadOnly(); - final File dst = fileFor(id); if (dst.exists()) { // We want to be extra careful and avoid replacing an object @@ -484,6 +482,7 @@ public class ObjectDirectory extends FileObjectDatabase { return InsertLooseObjectResult.EXISTS_LOOSE; } if (tmp.renameTo(dst)) { + tmp.setReadOnly(); unpackedObjectCache.add(id); return InsertLooseObjectResult.INSERTED; } |