summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-30 02:23:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-30 02:23:24 -0400
commita7e7dda55a82cb5007c5eaa2f7752f5cefdcb1d2 (patch)
tree4e65ff613ae755c4eeb01113b750ba449afd1272
parentc86a2f686aa447d1cf30cecaa2feedaf0e2c6ba2 (diff)
Fix referring to remotes by uuid.
I think that I broke this in some fairly recent refactoring.
-rw-r--r--Remote.hs12
-rw-r--r--debian/changelog1
2 files changed, 10 insertions, 3 deletions
diff --git a/Remote.hs b/Remote.hs
index 0ce01872a..05f70a5d7 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -87,7 +87,8 @@ genList = do
u <- getUUID r
generate t r u (M.lookup u m)
-{- Looks up a remote by name. (Or by UUID.) -}
+{- Looks up a remote by name. (Or by UUID.) Only finds currently configured
+ - git remotes. -}
byName :: String -> Annex (Remote Annex)
byName n = do
res <- byName' n
@@ -106,7 +107,8 @@ byName' n = do
matching r = n == name r || n == uuid r
{- Looks up a remote by name (or by UUID, or even by description),
- - and returns its UUID. -}
+ - and returns its UUID. Finds even remotes that are not configured in
+ - .git/config. -}
nameToUUID :: String -> Annex UUID
nameToUUID "." = getUUID =<< Annex.gitRepo -- special case for current repo
nameToUUID n = do
@@ -115,7 +117,11 @@ nameToUUID n = do
Left e -> fromMaybe (error e) <$> byDescription
Right r -> return $ uuid r
where
- byDescription = M.lookup n . invertMap <$> uuidMap
+ byDescription = do
+ m <- uuidMap
+ case M.lookup n $ invertMap m of
+ Just u -> return $ Just u
+ Nothing -> return $ M.lookup n m
invertMap = M.fromList . map swap . M.toList
swap (a, b) = (b, a)
diff --git a/debian/changelog b/debian/changelog
index 62b65333d..5354e710d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
git-annex (3.20110929) UNRELEASED; urgency=low
* Various speed improvements gained by using ByteStrings.
+ * Fix referring to remotes by uuid.
-- Joey Hess <joeyh@debian.org> Thu, 29 Sep 2011 18:58:53 -0400