summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Backend/WORM.hs10
-rw-r--r--debian/changelog4
-rw-r--r--doc/backends.mdwn2
-rw-r--r--doc/bugs/Possible_data-loss_if_WORM_keys_do_not_encode_relative_paths.mdwn1
4 files changed, 10 insertions, 7 deletions
diff --git a/Backend/WORM.hs b/Backend/WORM.hs
index 6ba513960..de7779bb3 100644
--- a/Backend/WORM.hs
+++ b/Backend/WORM.hs
@@ -12,6 +12,7 @@ import Types.Backend
import Types.Key
import Types.KeySource
import Backend.Utilities
+import Git.FilePath
backends :: [Backend]
backends = [backend]
@@ -27,16 +28,13 @@ backend = Backend
}
{- The key includes the file size, modification time, and the
- - basename of the filename.
- -
- - That allows multiple files with the same names to have different keys,
- - while also allowing a file to be moved around while retaining the
- - same key.
+ - original filename relative to the top of the git repository.
-}
keyValue :: KeySource -> Annex (Maybe Key)
keyValue source = do
stat <- liftIO $ getFileStatus $ contentLocation source
- n <- genKeyName $ takeFileName $ keyFilename source
+ relf <- getTopFilePath <$> inRepo (toTopFilePath $ keyFilename source)
+ n <- genKeyName relf
return $ Just $ stubKey
{ keyName = n
, keyBackendName = name backend
diff --git a/debian/changelog b/debian/changelog
index ec0684f03..710f72a34 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,10 @@ git-annex (5.20140832) UNRELEASED; urgency=medium
transfers.
* sync: Ensure that pending changes to git-annex branch are committed
when in direct mode. (Fixing a very minor reversion.)
+ * WORM backend: Switched to include the relative path to the file inside
+ the repository, rather than just the file's base name. Note that if you're
+ relying on such things to keep files separate with WORM, you should really
+ be using a better backend.
-- Joey Hess <joeyh@debian.org> Thu, 04 Sep 2014 16:17:22 -0400
diff --git a/doc/backends.mdwn b/doc/backends.mdwn
index baa96c149..06475adfb 100644
--- a/doc/backends.mdwn
+++ b/doc/backends.mdwn
@@ -13,7 +13,7 @@ can use different ones for different files.
* `SHA256` -- Does not include the file extension in the key, which can
lead to better deduplication but can confuse some programs.
* `WORM` ("Write Once, Read Many") This assumes that any file with
- the same basename, size, and modification time has the same content.
+ the same filename, size, and modification time has the same content.
This is the least expensive backend, recommended for really large
files or slow systems.
* `SHA512`, `SHA512E` -- Best SHA-2 hash, for the very paranoid.
diff --git a/doc/bugs/Possible_data-loss_if_WORM_keys_do_not_encode_relative_paths.mdwn b/doc/bugs/Possible_data-loss_if_WORM_keys_do_not_encode_relative_paths.mdwn
index 2b3cf3f2f..716c76f6c 100644
--- a/doc/bugs/Possible_data-loss_if_WORM_keys_do_not_encode_relative_paths.mdwn
+++ b/doc/bugs/Possible_data-loss_if_WORM_keys_do_not_encode_relative_paths.mdwn
@@ -21,3 +21,4 @@ Instead of just using the basename, WORM keys could be kept stable by
using the relative path and anchoring it to the root of the
repository.
+> [[fixed|done]] --[[Joey]]