diff options
Diffstat (limited to 'Git/LsTree.hs')
-rw-r--r-- | Git/LsTree.hs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Git/LsTree.hs b/Git/LsTree.hs index 5c1541819..8f9066f0f 100644 --- a/Git/LsTree.hs +++ b/Git/LsTree.hs @@ -14,7 +14,6 @@ module Git.LsTree ( import Numeric import Control.Applicative import System.Posix.Types -import qualified Data.Text.Lazy as L import Common import Git @@ -31,22 +30,22 @@ data TreeItem = TreeItem {- Lists the contents of a Ref -} lsTree :: Ref -> Repo -> IO [TreeItem] lsTree t repo = map parseLsTree <$> - pipeNullSplitT [Params "ls-tree --full-tree -z -r --", File $ show t] repo + pipeNullSplit [Params "ls-tree --full-tree -z -r --", File $ show t] repo {- Parses a line of ls-tree output. - (The --long format is not currently supported.) -} -parseLsTree :: L.Text -> TreeItem +parseLsTree :: String -> TreeItem parseLsTree l = TreeItem - { mode = fst $ Prelude.head $ readOct $ L.unpack m - , typeobj = L.unpack t - , sha = L.unpack s - , file = Git.Filename.decode $ L.unpack f + { mode = fst $ Prelude.head $ readOct m + , typeobj = t + , sha = s + , file = Git.Filename.decode f } where -- l = <mode> SP <type> SP <sha> TAB <file> -- All fields are fixed, so we can pull them out of -- specific positions in the line. - (m, past_m) = L.splitAt 7 l - (t, past_t) = L.splitAt 4 past_m - (s, past_s) = L.splitAt 40 $ L.tail past_t - f = L.tail past_s + (m, past_m) = splitAt 7 l + (t, past_t) = splitAt 4 past_m + (s, past_s) = splitAt 40 $ Prelude.tail past_t + f = Prelude.tail past_s |