diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-06 15:33:15 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-06 15:33:15 -0400 |
commit | f2299117152955d622d0ae0fcb396e56b1b7866d (patch) | |
tree | 2371e314acaefc5e51d345598e87301a18b1a2d9 /Annex | |
parent | c99fb589097d96b4e10cd8b137f72881cdb93118 (diff) |
optimization
The last commit added some git-log calls to a merge. This removes some,
by only merging branches that have unique refs.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Branch.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 0095b586b..163c9ec60 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -240,15 +240,16 @@ hasOrigin = refExists originname hasSomeBranch :: Annex Bool hasSomeBranch = not . null <$> siblingBranches -{- List of all git-annex (refs, branches), including the main one and any - - from remotes. -} +{- List of git-annex (refs, branches), including the main one and any + - from remotes. Duplicate refs are filtered out. -} siblingBranches :: Annex [(String, String)] siblingBranches = do g <- gitRepo r <- liftIO $ Git.pipeRead g [Param "show-ref", Param name] - return $ map (pair . words . L.unpack) (L.lines r) + return $ nubBy uref $ map (pair . words . L.unpack) (L.lines r) where pair l = (head l, last l) + uref (a, _) (b, _) = a == b {- Applies a function to modifiy the content of a file. -} change :: FilePath -> (String -> String) -> Annex () |