diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-28 17:35:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-28 17:35:47 -0400 |
commit | b4d5c10fb71a0aa938c7dde0b9aaf57d9e793874 (patch) | |
tree | 2cc8ceb6e755e7ee80837d9becbe571ccda4f6cd /Git.hs | |
parent | 297bc648b9a3c1b950e65f23a0e974b7934dc4dd (diff) |
refine new unused code
Fixed the laziness space leak, so it runs in 60 mb or so again. Slightly
faster due to using Data.Set.difference now, although this also makes it
use slightly more memory.
Also added display of the refs being checked, and made unused --from
also check all refs for things in the remote.
Diffstat (limited to 'Git.hs')
-rw-r--r-- | Git.hs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -20,6 +20,7 @@ module Git ( repoIsHttp, repoIsLocalBare, repoDescribe, + refDescribe, repoLocation, workTree, workTreeFile, @@ -171,6 +172,14 @@ repoDescribe Repo { location = Url url } = show url repoDescribe Repo { location = Dir dir } = dir repoDescribe Repo { location = Unknown } = "UNKNOWN" +{- Converts a fully qualified git ref into a user-visible version -} +refDescribe :: String -> String +refDescribe = remove "refs/heads/" . remove "refs/remotes/" + where + remove prefix s + | prefix `isPrefixOf` s = drop (length prefix) s + | otherwise = s + {- Location of the repo, either as a path or url. -} repoLocation :: Repo -> String repoLocation Repo { location = Url url } = show url |