handle transitions with read-only unmerged git-annex branches
Capstone to this feature. Any transitions that have been performed on an unmerged remote ref but not on the local git-annex branch, or vice-versa have to be applied on the fly when reading files. Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
1291a7d86c
commit
b1d719f9d2
9 changed files with 95 additions and 28 deletions
|
@ -9,6 +9,7 @@ module Types.BranchState where
|
|||
|
||||
import Common
|
||||
import qualified Git
|
||||
import Types.Transitions
|
||||
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
|
||||
|
@ -25,6 +26,9 @@ data BranchState = BranchState
|
|||
-- ^ when the branch was not able to be updated due to permissions,
|
||||
-- these other git refs contain unmerged information and need to be
|
||||
-- queried, along with the index and the journal.
|
||||
, unhandledTransitions :: [TransitionCalculator]
|
||||
-- ^ when the branch was not able to be updated due to permissions,
|
||||
-- this is transitions that need to be applied when making queries.
|
||||
, cachedFileContents :: [(RawFilePath, L.ByteString)]
|
||||
-- ^ contents of a few files recently read from the branch
|
||||
, needInteractiveAccess :: Bool
|
||||
|
@ -35,4 +39,4 @@ data BranchState = BranchState
|
|||
}
|
||||
|
||||
startBranchState :: BranchState
|
||||
startBranchState = BranchState False False False [] [] False
|
||||
startBranchState = BranchState False False False [] [] [] False
|
||||
|
|
19
Types/Transitions.hs
Normal file
19
Types/Transitions.hs
Normal file
|
@ -0,0 +1,19 @@
|
|||
{- git-annex transitions data types
|
||||
-
|
||||
- Copyright 2021 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Types.Transitions where
|
||||
|
||||
import Utility.RawFilePath
|
||||
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
import Data.ByteString.Builder
|
||||
|
||||
data FileTransition
|
||||
= ChangeFile Builder
|
||||
| PreserveFile
|
||||
|
||||
type TransitionCalculator = RawFilePath -> L.ByteString -> FileTransition
|
Loading…
Add table
Add a link
Reference in a new issue