simplify
and a bit faster using Eq this way
This commit is contained in:
parent
63ed61ae3d
commit
ec697721e4
1 changed files with 7 additions and 13 deletions
|
@ -188,8 +188,9 @@ buildImportCommit' importcommitconfig mtrackingcommit imported@(History ti _) =
|
||||||
importedcommit <- case getRemoteTrackingBranchImportHistory h of
|
importedcommit <- case getRemoteTrackingBranchImportHistory h of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
mkcommits imported
|
mkcommits imported
|
||||||
Just oldimported ->
|
Just oldimported@(History oldhc _) -> do
|
||||||
mknewcommits oldimported imported
|
let oldimportedtrees = mapHistory historyCommitTree oldimported
|
||||||
|
mknewcommits oldhc oldimportedtrees imported
|
||||||
Just <$> makeRemoteTrackingBranchMergeCommit'
|
Just <$> makeRemoteTrackingBranchMergeCommit'
|
||||||
trackingcommit importedcommit ti
|
trackingcommit importedcommit ti
|
||||||
where
|
where
|
||||||
|
@ -208,19 +209,12 @@ buildImportCommit' importcommitconfig mtrackingcommit imported@(History ti _) =
|
||||||
mkcommit parents importedtree
|
mkcommit parents importedtree
|
||||||
|
|
||||||
-- Reuse the commits from the old imported History when possible.
|
-- Reuse the commits from the old imported History when possible.
|
||||||
mknewcommits old@(History oldhc _) new@(History importedtree hs)
|
mknewcommits oldhc old new@(History importedtree hs)
|
||||||
| sameasold old new = return $ historyCommit oldhc
|
| old == new = return $ historyCommit oldhc
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
parents <- mapM (mknewcommits old) (S.toList hs)
|
parents <- mapM (mknewcommits oldhc old) (S.toList hs)
|
||||||
mkcommit parents importedtree
|
mkcommit parents importedtree
|
||||||
|
|
||||||
-- Are the trees in the old History the same as the newly imported
|
|
||||||
-- trees, all the way down?
|
|
||||||
sameasold (History oldhc olds) (History importedtree hs)
|
|
||||||
| historyCommitTree oldhc /= importedtree = False
|
|
||||||
| otherwise = all (sameasold' olds) (S.toList hs)
|
|
||||||
sameasold' olds h = any (\old -> sameasold old h) (S.toList olds)
|
|
||||||
|
|
||||||
{- Builds a history of git trees reflecting the ImportableContents.
|
{- Builds a history of git trees reflecting the ImportableContents.
|
||||||
-
|
-
|
||||||
- When a subdir is provided, imported tree is grafted into the basetree at
|
- When a subdir is provided, imported tree is grafted into the basetree at
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue