diff options
author | Joey Hess <joey@kitenet.net> | 2013-11-09 13:37:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-11-09 13:37:30 -0400 |
commit | 4807612214df574e1dd11dff68c7c55dbff73108 (patch) | |
tree | ff6577cd034d681373a39fbaf636d6209974a57f /Remote.hs | |
parent | e21c56e073d4fe720eb67b7c95daf4333f0f6813 (diff) |
Fix bug that caused bad information to be written to the git-annex branch when running describe or other commands with a remote that has no uuid.
Still need to fix crash caused by the bad info.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -90,11 +90,12 @@ byNameWithUUID = checkuuid <=< byName where checkuuid Nothing = return Nothing checkuuid (Just r) - | uuid r == NoUUID = do - let e = "cannot determine uuid for " ++ name r + | uuid r == NoUUID = if remoteAnnexIgnore (gitconfig r) - then error $ e ++ " (" ++ show (remoteConfig (repo r) "ignore") ++ " is set)" - else error e + then error $ noRemoteUUIDMsg r ++ + " (" ++ show (remoteConfig (repo r) "ignore") ++ + " is set)" + else error $ noRemoteUUIDMsg r | otherwise = return $ Just r byName' :: RemoteName -> Annex (Either String Remote) @@ -111,16 +112,21 @@ byNameOnly n = headMaybe . filter matching <$> remoteList where matching r = n == name r +noRemoteUUIDMsg :: Remote -> String +noRemoteUUIDMsg r = "cannot determine uuid for " ++ name r + {- Looks up a remote by name (or by UUID, or even by description), - - and returns its UUID. Finds even remotes that are not configured in - - .git/config. -} + - and returns its UUID. Finds even repositories that are not + - configured in .git/config. -} nameToUUID :: RemoteName -> Annex UUID nameToUUID "." = getUUID -- special case for current repo nameToUUID "here" = getUUID nameToUUID "" = error "no remote specified" nameToUUID n = byName' n >>= go where - go (Right r) = return $ uuid r + go (Right r) = case uuid r of + NoUUID -> error $ noRemoteUUIDMsg r + u -> return u go (Left e) = fromMaybe (error e) <$> bydescription bydescription = do m <- uuidMap |