summaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-04 21:32:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-04 21:32:57 -0400
commit5123a1a83aa3b954fe67629508bab5ccea0e4148 (patch)
tree8e6b5a8ab4f1b1a5e486a7338d49fff7ee2860bb /Remote.hs
parent9acd6ccff769b7db07e94659a4c8d1d7be132d91 (diff)
Bugfix: If the UUID of a remote is not known, prevent --from, --to, and other ways of specifying remotes by name from selecting it, since it is not possible to sanely use it.
For example, copy --to such a remote would send the file, but as NoUUID was its uuid, no location log update was done. And drop --from such a remote would not do anything, because NoUUID is not listed in the location log..
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Remote.hs b/Remote.hs
index 456716c6e..22e304de3 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -81,7 +81,9 @@ byName' "" = return $ Left "no remote specified"
byName' n = handle . filter matching <$> remoteList
where
handle [] = Left $ "there is no available git remote named \"" ++ n ++ "\""
- handle match = Right $ Prelude.head match
+ handle (match:_)
+ | uuid match == NoUUID = Left $ "cannot determine uuid for " ++ name match
+ | otherwise = Right match
matching r = n == name r || toUUID n == uuid r
{- Looks up a remote by name (or by UUID, or even by description),