--branch, stage 2
Show branch:file that is being operated on. I had to make ActionItem a type and not a type class because withKeyOptions' passed two different types of values when using the type class, and I could not get the type checker to accept that.
This commit is contained in:
parent
847944e6b1
commit
d13194b230
15 changed files with 145 additions and 102 deletions
|
@ -14,6 +14,8 @@
|
|||
|
||||
module Git.FilePath (
|
||||
TopFilePath,
|
||||
BranchFilePath(..),
|
||||
descBranchFilePath,
|
||||
getTopFilePath,
|
||||
fromTopFilePath,
|
||||
toTopFilePath,
|
||||
|
@ -33,6 +35,13 @@ import qualified System.FilePath.Posix
|
|||
newtype TopFilePath = TopFilePath { getTopFilePath :: FilePath }
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
{- A file in a branch or other treeish. -}
|
||||
data BranchFilePath = BranchFilePath Ref TopFilePath
|
||||
|
||||
{- Git uses the branch:file form to refer to a BranchFilePath -}
|
||||
descBranchFilePath :: BranchFilePath -> String
|
||||
descBranchFilePath (BranchFilePath b f) = fromRef b ++ ':' : getTopFilePath f
|
||||
|
||||
{- Path to a TopFilePath, within the provided git repo. -}
|
||||
fromTopFilePath :: TopFilePath -> Git.Repo -> FilePath
|
||||
fromTopFilePath p repo = combine (repoPath repo) (getTopFilePath p)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue