fix
This commit is contained in:
parent
64bc4e4751
commit
3c263cc9ea
1 changed files with 8 additions and 10 deletions
18
Remote.hs
18
Remote.hs
|
@ -107,21 +107,19 @@ byName' n = do
|
||||||
- .git/config. -}
|
- .git/config. -}
|
||||||
nameToUUID :: String -> Annex UUID
|
nameToUUID :: String -> Annex UUID
|
||||||
nameToUUID "." = getUUID -- special case for current repo
|
nameToUUID "." = getUUID -- special case for current repo
|
||||||
nameToUUID n = do
|
nameToUUID n = byName' n >>= go
|
||||||
res <- byName' n
|
|
||||||
case res of
|
|
||||||
Left e -> fromMaybe (error e) <$> byDescription
|
|
||||||
Right r -> return $ uuid r
|
|
||||||
where
|
where
|
||||||
byDescription = do
|
go (Right r) = return $ uuid r
|
||||||
|
go (Left e) = fromMaybe (error e) <$> bydescription
|
||||||
|
bydescription = do
|
||||||
m <- uuidMap
|
m <- uuidMap
|
||||||
case M.lookup wantuuid $ transform swap m of
|
case M.lookup n $ transform swap m of
|
||||||
Just u -> return $ Just u
|
Just u -> return $ Just u
|
||||||
Nothing -> return $ M.lookup wantuuid $ transform double m
|
Nothing -> return $ byuuid m
|
||||||
|
byuuid m = M.lookup (read n) $ transform double m
|
||||||
transform a = M.fromList . map a . M.toList
|
transform a = M.fromList . map a . M.toList
|
||||||
swap (a, b) = (b, a)
|
swap (a, b) = (b, a)
|
||||||
double (a, _) = (show a, a)
|
double (a, _) = (a, a)
|
||||||
wantuuid = read n
|
|
||||||
|
|
||||||
{- Pretty-prints a list of UUIDs of remotes, for human display.
|
{- Pretty-prints a list of UUIDs of remotes, for human display.
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue