Make git clean filter preserve the backend that was used for a file.

This commit is contained in:
Joey Hess 2016-06-09 15:17:08 -04:00
parent 78952c1fcf
commit b6b5a11601
Failed to extract signature
4 changed files with 21 additions and 4 deletions

View file

@ -11,6 +11,7 @@ module Annex.Ingest (
lockDown,
ingestAdd,
ingest,
ingest',
finishIngestDirect,
finishIngestUnlocked,
cleanOldKeys,
@ -140,9 +141,12 @@ ingestAdd ld@(Just (LockedDown cfg source)) = do
- tree or the index.
-}
ingest :: Maybe LockedDown -> Annex (Maybe Key, Maybe InodeCache)
ingest Nothing = return (Nothing, Nothing)
ingest (Just (LockedDown cfg source)) = withTSDelta $ \delta -> do
backend <- chooseBackend $ keyFilename source
ingest = ingest' Nothing
ingest' :: Maybe Backend -> Maybe LockedDown -> Annex (Maybe Key, Maybe InodeCache)
ingest' _ Nothing = return (Nothing, Nothing)
ingest' preferredbackend (Just (LockedDown cfg source)) = withTSDelta $ \delta -> do
backend <- maybe (chooseBackend $ keyFilename source) (return . Just) preferredbackend
k <- genKey source backend
let src = contentLocation source
ms <- liftIO $ catchMaybeIO $ getFileStatus src

View file

@ -31,6 +31,7 @@ git-annex (6.20160528) UNRELEASED; urgency=medium
* Make lock and unlock work in v6 repos on files whose content is not
present.
* Fix update of associated files db when unlocking a file in a v6 repo.
* Make git clean filter preserve the backend that was used for a file.
-- Joey Hess <id@joeyh.name> Fri, 27 May 2016 13:12:48 -0400

View file

@ -13,9 +13,11 @@ import Annex.Content
import Annex.Link
import Annex.FileMatcher
import Annex.Ingest
import Annex.CatFile
import Logs.Location
import qualified Database.Keys
import Git.FilePath
import Backend
import qualified Data.ByteString.Lazy as B
@ -78,8 +80,16 @@ clean file = do
-- and not stdin, we need to consume all
-- stdin, or git will get annoyed.
B.length b `seq` return ()
-- Look up the backend that was used
-- for this file before, so that when
-- git re-cleans a file its backend does
-- not change.
currbackend <- maybe Nothing (maybeLookupBackendName . keyBackendName)
<$> catKeyFile file
liftIO . emitPointer
=<< go =<< ingest =<< lockDown cfg file
=<< go
=<< ingest' currbackend
=<< lockDown cfg file
, liftIO $ B.hPut stdout b
)
stop

View file

@ -56,3 +56,5 @@ git-annex version: 6.20160523+gitg33c00ab-1~ndall+1
[[!meta author=yoh]]
> [[fixed|done]] --[[Joey]]