diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-15 16:58:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-15 16:58:04 -0400 |
commit | fbc3d32f7dca870bb68f16dcec0b601840313eb1 (patch) | |
tree | cc4e97f522325b785edf25e5408e1f9edb22dcd1 /Git/Ref.hs | |
parent | eb132a854ec9098acbc2a3caac5fd09947879268 (diff) |
avoid partial function, and parse git-ref output better
It's possible that a ref name might contain a space, this properly
preserves the space.
Diffstat (limited to 'Git/Ref.hs')
-rw-r--r-- | Git/Ref.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Git/Ref.hs b/Git/Ref.hs index 117ead8f2..0197ae789 100644 --- a/Git/Ref.hs +++ b/Git/Ref.hs @@ -41,8 +41,8 @@ sha branch repo = process . L.unpack <$> showref repo matching :: Ref -> Repo -> IO [(Ref, Branch)] matching ref repo = do r <- pipeRead [Param "show-ref", Param $ show ref] repo - return $ nubBy uref $ map (gen . words . L.unpack) (L.lines r) + return $ nubBy uniqref $ map (gen . L.unpack) (L.lines r) where - gen l = (Ref $ head l, Ref $ last l) - uref (a, _) (b, _) = a == b - + uniqref (a, _) (b, _) = a == b + gen l = let (r, b) = separate (== ' ') l in + (Ref r, Ref b) |