optimization

The last commit added some git-log calls to a merge. This removes some,
by only merging branches that have unique refs.
This commit is contained in:
Joey Hess 2011-11-06 15:33:15 -04:00
parent c99fb58909
commit f229911715

View file

@ -240,15 +240,16 @@ hasOrigin = refExists originname
hasSomeBranch :: Annex Bool hasSomeBranch :: Annex Bool
hasSomeBranch = not . null <$> siblingBranches hasSomeBranch = not . null <$> siblingBranches
{- List of all git-annex (refs, branches), including the main one and any {- List of git-annex (refs, branches), including the main one and any
- from remotes. -} - from remotes. Duplicate refs are filtered out. -}
siblingBranches :: Annex [(String, String)] siblingBranches :: Annex [(String, String)]
siblingBranches = do siblingBranches = do
g <- gitRepo g <- gitRepo
r <- liftIO $ Git.pipeRead g [Param "show-ref", Param name] 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 where
pair l = (head l, last l) pair l = (head l, last l)
uref (a, _) (b, _) = a == b
{- Applies a function to modifiy the content of a file. -} {- Applies a function to modifiy the content of a file. -}
change :: FilePath -> (String -> String) -> Annex () change :: FilePath -> (String -> String) -> Annex ()