summaryrefslogtreecommitdiff
path: root/Command/Smudge.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-09 15:17:08 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-09 15:17:08 -0400
commit37bc59962a9546682ae596e2c65099ca76accff2 (patch)
treea158ab8e8f3c79e61ea6a121e89e2fa22772be7f /Command/Smudge.hs
parent37b2a0d1ab5b0485869df3c91c81de021a11f185 (diff)
Make git clean filter preserve the backend that was used for a file.
Diffstat (limited to 'Command/Smudge.hs')
-rw-r--r--Command/Smudge.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Command/Smudge.hs b/Command/Smudge.hs
index 933a0a01e..5a4b879dd 100644
--- a/Command/Smudge.hs
+++ b/Command/Smudge.hs
@@ -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