summaryrefslogtreecommitdiff
path: root/GitRepo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-13 15:55:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-13 15:55:18 -0400
commite28ff5bdaf7ce56c0c928904ff883c1e2cd093de (patch)
tree53426c78f8d22c1a0b4e5a52811cd1299c97f85b /GitRepo.hs
parent77055f5ff82d2712f599ba77e03d5d2cc022ff65 (diff)
almost able to get files from remotes now!
Diffstat (limited to 'GitRepo.hs')
-rw-r--r--GitRepo.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/GitRepo.hs b/GitRepo.hs
index 06e244d6b..e1f086b69 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -13,6 +13,7 @@ module GitRepo (
gitRepoIsLocal,
gitRepoIsRemote,
gitConfigRemotes,
+ gitRepoDescribe,
gitWorkTree,
gitDir,
gitRelative,
@@ -74,8 +75,13 @@ gitRepoFromUrl url =
}
where path url = uriPath $ fromJust $ parseURI url
-{- User-visible description of a git repo by path or url -}
-describe repo = if (gitRepoIsLocal repo) then top repo else url repo
+{- User-visible description of a git repo. -}
+gitRepoDescribe repo =
+ if (isJust $ remoteName repo)
+ then fromJust $ remoteName repo
+ else if (gitRepoIsLocal repo)
+ then top repo
+ else url repo
{- Returns the name of the remote that corresponds to the repo, if
- it is a remote. Otherwise, "" -}
@@ -93,13 +99,13 @@ gitRepoIsRemote repo = not $ gitRepoIsLocal repo
assertlocal repo action =
if (gitRepoIsLocal repo)
then action
- else error $ "acting on remote git repo " ++ (describe repo) ++
+ else error $ "acting on remote git repo " ++ (gitRepoDescribe repo) ++
" not supported"
bare :: GitRepo -> Bool
bare repo =
if (member b (config repo))
then ("true" == fromJust (Map.lookup b (config repo)))
- else error $ "it is not known if git repo " ++ (describe repo) ++
+ else error $ "it is not known if git repo " ++ (gitRepoDescribe repo) ++
" is a bare repository; config not read"
where
b = "core.bare"