Make git clean filter preserve the backend that was used for a file.
This commit is contained in:
parent
78952c1fcf
commit
b6b5a11601
4 changed files with 21 additions and 4 deletions
|
@ -11,6 +11,7 @@ module Annex.Ingest (
|
||||||
lockDown,
|
lockDown,
|
||||||
ingestAdd,
|
ingestAdd,
|
||||||
ingest,
|
ingest,
|
||||||
|
ingest',
|
||||||
finishIngestDirect,
|
finishIngestDirect,
|
||||||
finishIngestUnlocked,
|
finishIngestUnlocked,
|
||||||
cleanOldKeys,
|
cleanOldKeys,
|
||||||
|
@ -140,9 +141,12 @@ ingestAdd ld@(Just (LockedDown cfg source)) = do
|
||||||
- tree or the index.
|
- tree or the index.
|
||||||
-}
|
-}
|
||||||
ingest :: Maybe LockedDown -> Annex (Maybe Key, Maybe InodeCache)
|
ingest :: Maybe LockedDown -> Annex (Maybe Key, Maybe InodeCache)
|
||||||
ingest Nothing = return (Nothing, Nothing)
|
ingest = ingest' Nothing
|
||||||
ingest (Just (LockedDown cfg source)) = withTSDelta $ \delta -> do
|
|
||||||
backend <- chooseBackend $ keyFilename source
|
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
|
k <- genKey source backend
|
||||||
let src = contentLocation source
|
let src = contentLocation source
|
||||||
ms <- liftIO $ catchMaybeIO $ getFileStatus src
|
ms <- liftIO $ catchMaybeIO $ getFileStatus src
|
||||||
|
|
|
@ -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
|
* Make lock and unlock work in v6 repos on files whose content is not
|
||||||
present.
|
present.
|
||||||
* Fix update of associated files db when unlocking a file in a v6 repo.
|
* 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
|
-- Joey Hess <id@joeyh.name> Fri, 27 May 2016 13:12:48 -0400
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,11 @@ import Annex.Content
|
||||||
import Annex.Link
|
import Annex.Link
|
||||||
import Annex.FileMatcher
|
import Annex.FileMatcher
|
||||||
import Annex.Ingest
|
import Annex.Ingest
|
||||||
|
import Annex.CatFile
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import qualified Database.Keys
|
import qualified Database.Keys
|
||||||
import Git.FilePath
|
import Git.FilePath
|
||||||
|
import Backend
|
||||||
|
|
||||||
import qualified Data.ByteString.Lazy as B
|
import qualified Data.ByteString.Lazy as B
|
||||||
|
|
||||||
|
@ -78,8 +80,16 @@ clean file = do
|
||||||
-- and not stdin, we need to consume all
|
-- and not stdin, we need to consume all
|
||||||
-- stdin, or git will get annoyed.
|
-- stdin, or git will get annoyed.
|
||||||
B.length b `seq` return ()
|
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
|
liftIO . emitPointer
|
||||||
=<< go =<< ingest =<< lockDown cfg file
|
=<< go
|
||||||
|
=<< ingest' currbackend
|
||||||
|
=<< lockDown cfg file
|
||||||
, liftIO $ B.hPut stdout b
|
, liftIO $ B.hPut stdout b
|
||||||
)
|
)
|
||||||
stop
|
stop
|
||||||
|
|
|
@ -56,3 +56,5 @@ git-annex version: 6.20160523+gitg33c00ab-1~ndall+1
|
||||||
|
|
||||||
|
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue