diff options
author | 2011-02-04 01:56:45 -0400 | |
---|---|---|
committer | 2011-02-04 01:56:45 -0400 | |
commit | ef2d4f650edff99b67554be9288face87159131e (patch) | |
tree | 1a491c065b660496db64bf853d6dc4787eef14a6 /GitRepo.hs | |
parent | 30869187f0890f9e742b4a5dbb4579b0fca6f7e4 (diff) |
fix absrepo data loss
it was dropping the config map for the repos it changed
Diffstat (limited to 'GitRepo.hs')
-rw-r--r-- | GitRepo.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/GitRepo.hs b/GitRepo.hs index 4b252868f..7bb20fc53 100644 --- a/GitRepo.hs +++ b/GitRepo.hs @@ -13,6 +13,7 @@ module GitRepo ( repoFromCwd, repoFromPath, repoFromUrl, + localToUrl, repoIsUrl, repoIsSsh, repoDescribe, @@ -109,6 +110,19 @@ repoFromUrl url Just v -> v Nothing -> error $ "bad url " ++ url +{- Converts a Local Repo into a remote repo, using the reference repo + - which is assumed to be on the same host. -} +localToUrl :: Repo -> Repo -> Repo +localToUrl reference r + | not $ repoIsUrl reference = error "internal error; reference repo not url" + | repoIsUrl r = r + | otherwise = r { location = Url $ fromJust $ parseURI absurl } + where + absurl = + urlScheme reference ++ "//" ++ + urlHostFull reference ++ + workTree r + {- User-visible description of a git repo. -} repoDescribe :: Repo -> String repoDescribe Repo { remoteName = Just name } = name @@ -338,7 +352,7 @@ configStore :: Repo -> String -> Repo configStore repo s = r { remotes = configRemotes r } where r = repo { config = configParse s } -{- Checks if a string fron git config is a true value. -} +{- Checks if a string from git config is a true value. -} configTrue :: String -> Bool configTrue s = map toLower s == "true" |