aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-08-22 12:01:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-08-22 12:01:53 -0400
commit0768ec19e2484fc7dbc4d0fd6502f7934018ee09 (patch)
treec9b311afe6f70e9690136cf7a312ae7d13dad3dd
parente591a2aec9fcdfad2ee6303804165af433a77342 (diff)
Better error message when trying to use a git remote that has annex.ignore set.
-rw-r--r--Config.hs3
-rw-r--r--Remote.hs16
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/cannot_determine_uuid_for_origin.mdwn13
4 files changed, 28 insertions, 6 deletions
diff --git a/Config.hs b/Config.hs
index 4d93a2af5..c37481ead 100644
--- a/Config.hs
+++ b/Config.hs
@@ -18,6 +18,9 @@ import Config.Cost
type UnqualifiedConfigKey = String
data ConfigKey = ConfigKey String
+instance Show ConfigKey where
+ show (ConfigKey s) = s
+
{- Looks up a setting in git config. -}
getConfig :: ConfigKey -> String -> Annex String
getConfig (ConfigKey key) def = fromRepo $ Git.Config.get key def
diff --git a/Remote.hs b/Remote.hs
index ea9317282..5dec6f3e5 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -55,6 +55,7 @@ import Logs.UUID
import Logs.Trust
import Logs.Location hiding (logStatus)
import Remote.List
+import Config
{- Map from UUIDs of Remotes to a calculated value. -}
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. -}
byNameWithUUID :: Maybe String -> Annex (Maybe Remote)
-byNameWithUUID n = do
- v <- byName n
- return $ checkuuid <$> v
+byNameWithUUID = checkuuid <=< byName
where
- checkuuid r
- | uuid r == NoUUID = error $ "cannot determine uuid for " ++ name r
- | otherwise = r
+ checkuuid Nothing = return Nothing
+ checkuuid (Just 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' "" = return $ Left "no remote specified"
diff --git a/debian/changelog b/debian/changelog
index 0aaad3958..120dc69dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ git-annex (4.20130816) UNRELEASED; urgency=low
* Set --clobber when running wget to ensure resuming works properly.
* unused: Pay attention to symlinks that are not yet staged in the index.
* 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
diff --git a/doc/bugs/cannot_determine_uuid_for_origin.mdwn b/doc/bugs/cannot_determine_uuid_for_origin.mdwn
index 6d032c630..ce46e5733 100644
--- a/doc/bugs/cannot_determine_uuid_for_origin.mdwn
+++ b/doc/bugs/cannot_determine_uuid_for_origin.mdwn
@@ -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/*
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]]