Fix bug that caused bad information to be written to the git-annex branch when running describe or other commands with a remote that has no uuid.

Still need to fix crash caused by the bad info.
This commit is contained in:
Joey Hess 2013-11-09 13:37:30 -04:00
parent f3c714293a
commit 46cf00ffd8
2 changed files with 15 additions and 7 deletions

View file

@ -90,11 +90,12 @@ byNameWithUUID = checkuuid <=< byName
where
checkuuid Nothing = return Nothing
checkuuid (Just r)
| uuid r == NoUUID = do
let e = "cannot determine uuid for " ++ name r
| uuid r == NoUUID =
if remoteAnnexIgnore (gitconfig r)
then error $ e ++ " (" ++ show (remoteConfig (repo r) "ignore") ++ " is set)"
else error e
then error $ noRemoteUUIDMsg r ++
" (" ++ show (remoteConfig (repo r) "ignore") ++
" is set)"
else error $ noRemoteUUIDMsg r
| otherwise = return $ Just r
byName' :: RemoteName -> Annex (Either String Remote)
@ -111,16 +112,21 @@ byNameOnly n = headMaybe . filter matching <$> remoteList
where
matching r = n == name r
noRemoteUUIDMsg :: Remote -> String
noRemoteUUIDMsg r = "cannot determine uuid for " ++ name r
{- Looks up a remote by name (or by UUID, or even by description),
- and returns its UUID. Finds even remotes that are not configured in
- .git/config. -}
- and returns its UUID. Finds even repositories that are not
- configured in .git/config. -}
nameToUUID :: RemoteName -> Annex UUID
nameToUUID "." = getUUID -- special case for current repo
nameToUUID "here" = getUUID
nameToUUID "" = error "no remote specified"
nameToUUID n = byName' n >>= go
where
go (Right r) = return $ uuid r
go (Right r) = case uuid r of
NoUUID -> error $ noRemoteUUIDMsg r
u -> return u
go (Left e) = fromMaybe (error e) <$> bydescription
bydescription = do
m <- uuidMap

2
debian/changelog vendored
View file

@ -22,6 +22,8 @@ git-annex (5.20131102) UNRELEASED; urgency=low
* Include ssh-keygen in standalone bundle.
* Allow optionally configuring git-annex with -fEKG to enable awesome
remote monitoring interfaceat http://localhost:4242/
* Fix bug that caused bad information to be written to the git-annex branch
when running describe or other commands with a remote that has no uuid.
-- Joey Hess <joeyh@debian.org> Wed, 06 Nov 2013 16:14:14 -0400