SHAnE backends are now smarter about composite extensions, such as .tar.gz Closes: #680450

This commit is contained in:
Joey Hess 2012-07-05 16:24:02 -06:00
parent 25701717eb
commit 5a753a7b8a
2 changed files with 11 additions and 8 deletions

View file

@ -97,16 +97,17 @@ keyValueE :: SHASize -> KeySource -> Annex (Maybe Key)
keyValueE size source = keyValue size source >>= maybe (return Nothing) addE keyValueE size source = keyValue size source >>= maybe (return Nothing) addE
where where
addE k = return $ Just $ k addE k = return $ Just $ k
{ keyName = keyName k ++ extension { keyName = keyName k ++ selectExtension (keyFilename source)
, keyBackendName = shaNameE size , keyBackendName = shaNameE size
} }
naiveextension = takeExtension $ keyFilename source
extension selectExtension :: FilePath -> String
-- long or newline containing extensions are selectExtension = join "." . reverse . take 2 . takeWhile shortenough .
-- probably not really an extension reverse . split "." . takeExtensions
| length naiveextension > 6 || where
'\n' `elem` naiveextension = "" shortenough e
| otherwise = naiveextension | '\n' `elem` e = False -- newline in extension?!
| otherwise = length e <= 4 -- long enough for "jpeg"
{- A key's checksum is checked during fsck. -} {- A key's checksum is checked during fsck. -}
checkKeyChecksum :: SHASize -> Key -> FilePath -> Annex Bool checkKeyChecksum :: SHASize -> Key -> FilePath -> Annex Bool

2
debian/changelog vendored
View file

@ -9,6 +9,8 @@ git-annex (3.20120630) UNRELEASED; urgency=low
but avoids portability problems. but avoids portability problems.
* Use SHA library for files less than 50 kb in size, at which point it's * Use SHA library for files less than 50 kb in size, at which point it's
faster than forking the more optimised external program. faster than forking the more optimised external program.
* SHAnE backends are now smarter about composite extensions, such as
.tar.gz Closes: #680450
-- Joey Hess <joeyh@debian.org> Sun, 01 Jul 2012 15:04:37 -0400 -- Joey Hess <joeyh@debian.org> Sun, 01 Jul 2012 15:04:37 -0400