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.
This commit is contained in:
parent
ea9f66ef6a
commit
9711d529c8
4 changed files with 10 additions and 7 deletions
|
@ -12,6 +12,7 @@ import Types.Backend
|
||||||
import Types.Key
|
import Types.Key
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
import Backend.Utilities
|
import Backend.Utilities
|
||||||
|
import Git.FilePath
|
||||||
|
|
||||||
backends :: [Backend]
|
backends :: [Backend]
|
||||||
backends = [backend]
|
backends = [backend]
|
||||||
|
@ -27,16 +28,13 @@ backend = Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
{- The key includes the file size, modification time, and the
|
{- The key includes the file size, modification time, and the
|
||||||
- basename of the filename.
|
- original filename relative to the top of the git repository.
|
||||||
-
|
|
||||||
- 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.
|
|
||||||
-}
|
-}
|
||||||
keyValue :: KeySource -> Annex (Maybe Key)
|
keyValue :: KeySource -> Annex (Maybe Key)
|
||||||
keyValue source = do
|
keyValue source = do
|
||||||
stat <- liftIO $ getFileStatus $ contentLocation source
|
stat <- liftIO $ getFileStatus $ contentLocation source
|
||||||
n <- genKeyName $ takeFileName $ keyFilename source
|
relf <- getTopFilePath <$> inRepo (toTopFilePath $ keyFilename source)
|
||||||
|
n <- genKeyName relf
|
||||||
return $ Just $ stubKey
|
return $ Just $ stubKey
|
||||||
{ keyName = n
|
{ keyName = n
|
||||||
, keyBackendName = name backend
|
, keyBackendName = name backend
|
||||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -16,6 +16,10 @@ git-annex (5.20140832) UNRELEASED; urgency=medium
|
||||||
transfers.
|
transfers.
|
||||||
* sync: Ensure that pending changes to git-annex branch are committed
|
* sync: Ensure that pending changes to git-annex branch are committed
|
||||||
when in direct mode. (Fixing a very minor reversion.)
|
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
|
-- Joey Hess <joeyh@debian.org> Thu, 04 Sep 2014 16:17:22 -0400
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ can use different ones for different files.
|
||||||
* `SHA256` -- Does not include the file extension in the key, which can
|
* `SHA256` -- Does not include the file extension in the key, which can
|
||||||
lead to better deduplication but can confuse some programs.
|
lead to better deduplication but can confuse some programs.
|
||||||
* `WORM` ("Write Once, Read Many") This assumes that any file with
|
* `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
|
This is the least expensive backend, recommended for really large
|
||||||
files or slow systems.
|
files or slow systems.
|
||||||
* `SHA512`, `SHA512E` -- Best SHA-2 hash, for the very paranoid.
|
* `SHA512`, `SHA512E` -- Best SHA-2 hash, for the very paranoid.
|
||||||
|
|
|
@ -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
|
using the relative path and anchoring it to the root of the
|
||||||
repository.
|
repository.
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue