introduce Path.relativeSingleton to replace textToRelative

This commit is contained in:
Arya Irani 2020-02-04 15:03:56 -05:00
parent f7a73e4780
commit ff2414f02a
2 changed files with 6 additions and 5 deletions

View File

@ -530,11 +530,9 @@ loop = do
LoadPullRequestI baseRepo headRepo -> LoadPullRequestI baseRepo headRepo ->
if Branch.isEmpty0 currentBranch0 then do if Branch.isEmpty0 currentBranch0 then do
let textToRelative = let base = Path.relativeSingleton "base"
Path.Relative . Path.Path . Seq.singleton . NameSegment.NameSegment head = Path.relativeSingleton "head"
base = textToRelative "base" merged = Path.relativeSingleton "merged"
head = textToRelative "head"
merged = textToRelative "merged"
abs = resolveToAbsolute . Path.Path' . Right abs = resolveToAbsolute . Path.Path' . Right
-- 1. pull baseRepo into `base` -- 1. pull baseRepo into `base`
-- 2. pull headRepo into `head` -- 2. pull headRepo into `head`

View File

@ -218,6 +218,9 @@ absoluteEmpty = Absolute empty
relativeEmpty' :: Path' relativeEmpty' :: Path'
relativeEmpty' = Path' (Right (Relative empty)) relativeEmpty' = Path' (Right (Relative empty))
relativeSingleton :: NameSegment -> Relative
relativeSingleton = Relative . Path . Seq.singleton
toAbsolutePath :: Absolute -> Path' -> Absolute toAbsolutePath :: Absolute -> Path' -> Absolute
toAbsolutePath cur (Path' p) = either id (relativeToAbsolutePath cur) p toAbsolutePath cur (Path' p) = either id (relativeToAbsolutePath cur) p