diff --git a/Command/Map.hs b/Command/Map.hs index 94b1289dc0..f2ac520472 100644 --- a/Command/Map.hs +++ b/Command/Map.hs @@ -35,7 +35,7 @@ seek = [withNothing start] start :: CommandStart start = do - rs <- spider =<< gitRepo + rs <- combineSame <$> (spider =<< gitRepo) umap <- uuidMap trusted <- trustGet Trusted @@ -77,7 +77,7 @@ hostname r | otherwise = "localhost" basehostname :: Git.Repo -> String -basehostname r = Prelude.head $ split "." $ hostname r +basehostname r = fromMaybe "" $ headMaybe $ split "." $ hostname r {- A name to display for a repo. Uses the name from uuid.log if available, - or the remote name if not. -} @@ -236,3 +236,11 @@ tryScan r sshnote = do showAction "sshing" showOutput + +{- Spidering can find multiple paths to the same repo, so this is used + - to combine (really remove) duplicate repos with the same UUID. -} +combineSame :: [Git.Repo] -> [Git.Repo] +combineSame = map snd . nubBy sameuuid . map pair + where + sameuuid (u1, _) (u2, _) = u1 == u2 && u1 /= NoUUID + pair r = (getUncachedUUID r, r) diff --git a/debian/changelog b/debian/changelog index d8833865fa..3cb1ec86bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ git-annex (4.20130315) UNRELEASED; urgency=low * xmpp: Re-enable XA flag, since disabling it did not turn out to help with the problems Google Talk has with not always sending presence messages to clients. + * map: Combine duplicate repositories, for a nicer looking map. -- Joey Hess Fri, 15 Mar 2013 00:10:07 -0400