Better error message when trying to use a git remote that has annex.ignore set.

This commit is contained in:
Joey Hess 2013-08-22 12:01:53 -04:00
parent 9ab3010100
commit 74034ec781
4 changed files with 28 additions and 6 deletions

View file

@ -18,6 +18,9 @@ import Config.Cost
type UnqualifiedConfigKey = String type UnqualifiedConfigKey = String
data ConfigKey = ConfigKey String data ConfigKey = ConfigKey String
instance Show ConfigKey where
show (ConfigKey s) = s
{- Looks up a setting in git config. -} {- Looks up a setting in git config. -}
getConfig :: ConfigKey -> String -> Annex String getConfig :: ConfigKey -> String -> Annex String
getConfig (ConfigKey key) def = fromRepo $ Git.Config.get key def getConfig (ConfigKey key) def = fromRepo $ Git.Config.get key def

View file

@ -55,6 +55,7 @@ import Logs.UUID
import Logs.Trust import Logs.Trust
import Logs.Location hiding (logStatus) import Logs.Location hiding (logStatus)
import Remote.List import Remote.List
import Config
{- Map from UUIDs of Remotes to a calculated value. -} {- Map from UUIDs of Remotes to a calculated value. -}
remoteMap :: (Remote -> a) -> Annex (M.Map UUID a) remoteMap :: (Remote -> a) -> Annex (M.Map UUID a)
@ -81,13 +82,16 @@ byName (Just n) = either error Just <$> byName' n
{- Like byName, but the remote must have a configured UUID. -} {- Like byName, but the remote must have a configured UUID. -}
byNameWithUUID :: Maybe String -> Annex (Maybe Remote) byNameWithUUID :: Maybe String -> Annex (Maybe Remote)
byNameWithUUID n = do byNameWithUUID = checkuuid <=< byName
v <- byName n
return $ checkuuid <$> v
where where
checkuuid r checkuuid Nothing = return Nothing
| uuid r == NoUUID = error $ "cannot determine uuid for " ++ name r checkuuid (Just r)
| otherwise = r | uuid r == NoUUID = do
let e = "cannot determine uuid for " ++ name r
if remoteAnnexIgnore (gitconfig r)
then error $ e ++ " (" ++ show (remoteConfig (repo r) "ignore") ++ " is set)"
else error e
| otherwise = return $ Just r
byName' :: String -> Annex (Either String Remote) byName' :: String -> Annex (Either String Remote)
byName' "" = return $ Left "no remote specified" byName' "" = return $ Left "no remote specified"

2
debian/changelog vendored
View file

@ -10,6 +10,8 @@ git-annex (4.20130816) UNRELEASED; urgency=low
* Set --clobber when running wget to ensure resuming works properly. * Set --clobber when running wget to ensure resuming works properly.
* unused: Pay attention to symlinks that are not yet staged in the index. * unused: Pay attention to symlinks that are not yet staged in the index.
* Unescape characters in 'file://...' URIs. (Thanks, guilhem for the patch.) * Unescape characters in 'file://...' URIs. (Thanks, guilhem for the patch.)
* Better error message when trying to use a git remote that has annex.ignore
set.
-- Joey Hess <joeyh@debian.org> Thu, 15 Aug 2013 15:47:52 +0200 -- Joey Hess <joeyh@debian.org> Thu, 15 Aug 2013 15:47:52 +0200

View file

@ -120,3 +120,16 @@ Update: it seems te problem was that I had the following in my `.git/config`:
fetch = +refs/heads/*:refs/remotes/marcos-bare/* fetch = +refs/heads/*:refs/remotes/marcos-bare/*
I have *no* idea how that `annex-ignore` got there, but that was the root of my problem. Removing it it allowed my to do `git annex copy`. I really don't know how this happened, but I guess this is [[done]], although I believe this error message is really confusing and could be improved. I have *no* idea how that `annex-ignore` got there, but that was the root of my problem. Removing it it allowed my to do `git annex copy`. I really don't know how this happened, but I guess this is [[done]], although I believe this error message is really confusing and could be improved.
> `annex-ignore` is set automatically by git-annex if it fails to query
> the uuid of a remote the first time it tries to use it. It will say
> when it does that. The assumption
> is that a remote whose uuid cannot be looked up is a git remote
> on a server w/o git-annex support (like github) and it would be annoying
> to constantly be trying and failing to get that uuid.
>
> So, I've improved the error message. Now when annex-ignore is set
> for a remote, the error you got will mention that.
>
> (Also, there is not currently anything lacking in git-annex's support
> for bare repositories.) --[[Joey]]