summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-09 13:54:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-09 13:54:54 -0400
commitad4e152fd656bf16b227ffed9d65e01c3e181fcc (patch)
tree6e3cd5e6caaa479dc43d2842ae17f7d5d907ad27
parent5fc8c2b07b97baf7f08f9360ca375ad73aea2934 (diff)
S3: Add fileprefix setting.
-rw-r--r--Remote/S3.hs8
-rw-r--r--debian/changelog6
-rw-r--r--doc/special_remotes/S3.mdwn6
3 files changed, 17 insertions, 3 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index dca08fff8..bec089a4a 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -212,9 +212,11 @@ s3Action r noconn action = do
bucketFile :: Remote -> Key -> FilePath
bucketFile r = munge . show
where
- munge s = case M.lookup "mungekeys" $ fromJust $ config r of
- Just "ia" -> iaMunge s
- _ -> s
+ munge s = case M.lookup "mungekeys" c of
+ Just "ia" -> iaMunge $ prefix ++ s
+ _ -> prefix ++ s
+ prefix = M.findWithDefault "" "fileprefix" c
+ c = fromJust $ config r
bucketKey :: Remote -> String -> Key -> S3Object
bucketKey r bucket k = S3Object bucket (bucketFile r k) "" [] L.empty
diff --git a/debian/changelog b/debian/changelog
index c215bca43..1c48a196d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+git-annex (3.20120808) UNRELEASED; urgency=low
+
+ * S3: Add fileprefix setting.
+
+ -- Joey Hess <joeyh@debian.org> Thu, 09 Aug 2012 13:51:47 -0400
+
git-annex (3.20120807) unstable; urgency=low
* initremote: Avoid recording remote's description before checking
diff --git a/doc/special_remotes/S3.mdwn b/doc/special_remotes/S3.mdwn
index 195693b3b..333e0bac5 100644
--- a/doc/special_remotes/S3.mdwn
+++ b/doc/special_remotes/S3.mdwn
@@ -36,5 +36,11 @@ the S3 remote.
so by default, a bucket name is chosen based on the remote name
and UUID. This can be specified to pick a bucket name.
+* `fileprefix` - By default, git-annex places files in a tree rooted at the
+ top of the S3 bucket. When this is set, it's prefixed to the filenames
+ used. For example, you could set it to "foo/" in one special remote,
+ and to "bar/" in another special remote, and both special remotes could
+ then use the same bucket.
+
* `x-amz-*` are passed through as http headers when storing keys
in S3.