From ad4e152fd656bf16b227ffed9d65e01c3e181fcc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 9 Aug 2012 13:54:54 -0400 Subject: [PATCH] S3: Add fileprefix setting. --- Remote/S3.hs | 8 +++++--- debian/changelog | 6 ++++++ doc/special_remotes/S3.mdwn | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Remote/S3.hs b/Remote/S3.hs index dca08fff8b..bec089a4a7 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 c215bca43a..1c48a196d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +git-annex (3.20120808) UNRELEASED; urgency=low + + * S3: Add fileprefix setting. + + -- Joey Hess 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 195693b3b3..333e0bac59 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.