summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-11 14:50:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-11 14:50:18 -0400
commit647feed2d73a80c516c9b4bba29d6647c2af2f94 (patch)
tree4b39e2c399a083976d8d470a6c84fa571772e81e /Backend
parent870f2cd10cecd61bbf9ff8c0f229bcb63b5b2a31 (diff)
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.
Diffstat (limited to 'Backend')
-rw-r--r--Backend/WORM.hs10
1 files changed, 4 insertions, 6 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