rename repoName to repoDesc

That's what the function mostly is, if it shows a remote name it's only
in an edge case, where that is the best description of it available.
This commit is contained in:
Joey Hess 2025-05-29 12:55:40 -04:00
parent 2fad57de44
commit f6eac67f0e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -110,8 +110,8 @@ basehostname r = fromMaybe "" $ headMaybe $ splitc '.' $ hostname r
{- A description to display for a repo. Uses the description {- A description to display for a repo. Uses the description
- from uuid.log if available, or the remote name if not. -} - from uuid.log if available, or the remote name if not. -}
repoName :: UUIDDescMap -> Git.Repo -> String repoDesc :: UUIDDescMap -> Git.Repo -> String
repoName umap r repoDesc umap r
| repouuid == NoUUID = fallback | repouuid == NoUUID = fallback
| otherwise = maybe fallback fromUUIDDesc $ M.lookup repouuid umap | otherwise = maybe fallback fromUUIDDesc $ M.lookup repouuid umap
where where
@ -131,7 +131,7 @@ node umap fullinfo trustmap (r, rs) = unlines $ n:edges
where where
n = Dot.subGraph (hostname r) (basehostname r) "lightblue" $ n = Dot.subGraph (hostname r) (basehostname r) "lightblue" $
trustDecorate trustmap (getUncachedUUID r) $ trustDecorate trustmap (getUncachedUUID r) $
Dot.graphNode (nodeId r) (repoName umap r) Dot.graphNode (nodeId r) (repoDesc umap r)
edges = map (edge umap fullinfo r) rs edges = map (edge umap fullinfo r) rs
{- An edge between two repos. The second repo is a remote of the first. -} {- An edge between two repos. The second repo is a remote of the first. -}
@ -150,7 +150,7 @@ edge umap fullinfo from to =
- different from its hostname. (This reduces visual clutter.) -} - different from its hostname. (This reduces visual clutter.) -}
edgename = maybe Nothing calcname $ Git.remoteName to edgename = maybe Nothing calcname $ Git.remoteName to
calcname n calcname n
| n `elem` [repoName umap fullto, hostname fullto] = Nothing | n `elem` [repoDesc umap fullto, hostname fullto] = Nothing
| otherwise = Just n | otherwise = Just n
trustDecorate :: TrustMap -> UUID -> String -> String trustDecorate :: TrustMap -> UUID -> String -> String
@ -309,7 +309,7 @@ outputJSONMap rs trustmap umap =
] ]
mknode (r, remotes) = JSON.object mknode (r, remotes) = JSON.object
[ "description" .= packString (repoName umap r) [ "description" .= packString (repoDesc umap r)
, "uuid" .= mkuuid (getUncachedUUID r) , "uuid" .= mkuuid (getUncachedUUID r)
, "url" .= packString (Git.repoLocation r) , "url" .= packString (Git.repoLocation r)
, "remotes" .= map mkremote (filterdead id remotes) , "remotes" .= map mkremote (filterdead id remotes)