summaryrefslogtreecommitdiff
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
parent37b2a0d1ab5b0485869df3c91c81de021a11f185 (diff)
Make git clean filter preserve the backend that was used for a file.
-rw-r--r--Annex/Ingest.hs10
-rw-r--r--CHANGELOG1
-rw-r--r--Command/Smudge.hs12
-rw-r--r--doc/bugs/git_annex_adjust_--unlock_seems_to_cause_migration_of_a_file_to_another_backend.mdwn2
4 files changed, 21 insertions, 4 deletions
diff --git a/Annex/Ingest.hs b/Annex/Ingest.hs
index 95bbff496..7b1db8aa7 100644
--- a/Annex/Ingest.hs
+++ b/Annex/Ingest.hs
@@ -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
diff --git a/CHANGELOG b/CHANGELOG
index a5ccf1ae9..762ccbff7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
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
diff --git a/doc/bugs/git_annex_adjust_--unlock_seems_to_cause_migration_of_a_file_to_another_backend.mdwn b/doc/bugs/git_annex_adjust_--unlock_seems_to_cause_migration_of_a_file_to_another_backend.mdwn
index 443a1abd2..8cb93952a 100644
--- a/doc/bugs/git_annex_adjust_--unlock_seems_to_cause_migration_of_a_file_to_another_backend.mdwn
+++ b/doc/bugs/git_annex_adjust_--unlock_seems_to_cause_migration_of_a_file_to_another_backend.mdwn
@@ -56,3 +56,5 @@ git-annex version: 6.20160523+gitg33c00ab-1~ndall+1
[[!meta author=yoh]]
+
+> [[fixed|done]] --[[Joey]]