WORM backend: When adding a file in a subdirectory, avoid including the subdirectory in the key name.

This commit is contained in:
Joey Hess 2014-08-12 14:38:53 -04:00
parent 4ae25032c6
commit f0df660570
3 changed files with 14 additions and 1 deletions

View file

@ -36,7 +36,7 @@ backend = Backend
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 $ keyFilename source n <- genKeyName $ takeFileName $ keyFilename source
return $ Just $ stubKey return $ Just $ stubKey
{ keyName = n { keyName = n
, keyBackendName = name backend , keyBackendName = name backend

2
debian/changelog vendored
View file

@ -31,6 +31,8 @@ git-annex (5.20140718) UNRELEASED; urgency=medium
repositories, for safer detection of eg, renaming of files with the same repositories, for safer detection of eg, renaming of files with the same
size and mtime. size and mtime.
* direct: Fix ugly warning messages. * direct: Fix ugly warning messages.
* WORM backend: When adding a file in a subdirectory, avoid including the
subdirectory in the key name.
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400 -- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400

View file

@ -55,3 +55,14 @@ $ readlink quux
Linux 3.15.8 Linux 3.15.8
git-annex 5.20140716 git-annex 5.20140716
> This was a bug. I suspect it got broken a while ago and I didn't noticed
> since I rarely use WORM and when I do it's almost always adding files
> in the current directory. [[fixed|done]] to take the filename only.
>
> I don't think it's a problem to have the subdirectory path in the
> existing WORM keys, other than the problems you note with this meaning
> a later add of the same file will generate a different key. So I have not
> done anything to try to fix up existing keys. (If this became a problem,
> I could add upgrade code to the WORM backend.)
> --[[Joey]]