Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce2014-11-25 17:54:58 +0000
committerShawn Pearce2014-11-25 18:21:48 +0000
commit67b8bcc1c4b50fcccbdd02be8d50a65e1484460e (patch)
tree6e62d68b0e3c4d6d8c17f529ade56f6bdf55efae
parentf31323745f90aeb8f0b9bd0df4248363fc284bfe (diff)
downloadjgit-67b8bcc1c4b50fcccbdd02be8d50a65e1484460e.tar.gz
jgit-67b8bcc1c4b50fcccbdd02be8d50a65e1484460e.tar.xz
jgit-67b8bcc1c4b50fcccbdd02be8d50a65e1484460e.zip
AmazonS3: Buffer pushed pack content under $GIT_DIR
This applies the same filesystem permissions as the source objects. Users may override in properties files using the tmpdir value. Change-Id: I3ec332cf41f12eae246cfaee9fd792c52cb2908b
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java6
2 files changed, 12 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index 99d8b09d87..722bfc489d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -182,6 +182,9 @@ public class AmazonS3 {
/** Encryption algorithm, may be a null instance that provides pass-through. */
private final WalkEncryption encryption;
+ /** Directory for locally buffered content. */
+ private final File tmpDir;
+
/**
* Create a new S3 client for the supplied user information.
* <p>
@@ -251,6 +254,9 @@ public class AmazonS3 {
maxAttempts = Integer.parseInt(props.getProperty(
"httpclient.retry-max", "3")); //$NON-NLS-1$ //$NON-NLS-2$
proxySelector = ProxySelector.getDefault();
+
+ String tmp = props.getProperty("tmpdir"); //$NON-NLS-1$
+ tmpDir = tmp != null && tmp.length() > 0 ? new File(tmp) : null;
}
/**
@@ -452,7 +458,7 @@ public class AmazonS3 {
final ProgressMonitor monitor, final String monitorTask)
throws IOException {
final MessageDigest md5 = newMD5();
- final TemporaryBuffer buffer = new TemporaryBuffer.LocalFile() {
+ final TemporaryBuffer buffer = new TemporaryBuffer.LocalFile(tmpDir) {
@Override
public void close() throws IOException {
super.close();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
index b3a55a581b..afaaa69a43 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
@@ -147,7 +147,11 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
throws NotSupportedException {
super(local, uri);
- s3 = new AmazonS3(loadProperties());
+ Properties props = loadProperties();
+ if (!props.contains("tmpdir") && local.getDirectory() != null) //$NON-NLS-1$
+ props.put("tmpdir", local.getDirectory().getPath()); //$NON-NLS-1$
+
+ s3 = new AmazonS3(props);
bucket = uri.getHost();
String p = uri.getPath();

Back to the top