diff options
author | Joey Hess <joey@kitenet.net> | 2013-08-22 12:01:53 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-08-22 12:01:53 -0400 |
commit | 0768ec19e2484fc7dbc4d0fd6502f7934018ee09 (patch) | |
tree | c9b311afe6f70e9690136cf7a312ae7d13dad3dd /Remote.hs | |
parent | e591a2aec9fcdfad2ee6303804165af433a77342 (diff) |
Better error message when trying to use a git remote that has annex.ignore set.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -55,6 +55,7 @@ import Logs.UUID import Logs.Trust import Logs.Location hiding (logStatus) import Remote.List +import Config {- Map from UUIDs of Remotes to a calculated value. -} remoteMap :: (Remote -> a) -> Annex (M.Map UUID a) @@ -81,13 +82,16 @@ byName (Just n) = either error Just <$> byName' n {- Like byName, but the remote must have a configured UUID. -} byNameWithUUID :: Maybe String -> Annex (Maybe Remote) -byNameWithUUID n = do - v <- byName n - return $ checkuuid <$> v +byNameWithUUID = checkuuid <=< byName where - checkuuid r - | uuid r == NoUUID = error $ "cannot determine uuid for " ++ name r - | otherwise = r + checkuuid Nothing = return Nothing + checkuuid (Just r) + | uuid r == NoUUID = do + let e = "cannot determine uuid for " ++ name r + if remoteAnnexIgnore (gitconfig r) + then error $ e ++ " (" ++ show (remoteConfig (repo r) "ignore") ++ " is set)" + else error e + | otherwise = return $ Just r byName' :: String -> Annex (Either String Remote) byName' "" = return $ Left "no remote specified" |