git-annex-shell: Improve error message when the specified repository doesn't exist or git config fails for some reason.

This commit is contained in:
Joey Hess 2015-03-05 21:45:42 -04:00
parent 310bc80fd6
commit 3439ea4bdc
2 changed files with 10 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import System.Console.GetOpt
import Common.Annex import Common.Annex
import qualified Git.Construct import qualified Git.Construct
import qualified Git.Config
import CmdLine import CmdLine
import Command import Command
import Annex.UUID import Annex.UUID
@ -101,11 +102,16 @@ builtin cmd dir params = do
let (params', fieldparams, opts) = partitionParams params let (params', fieldparams, opts) = partitionParams params
fields = filter checkField $ parseFields fieldparams fields = filter checkField $ parseFields fieldparams
cmds' = map (newcmd $ unwords opts) cmds cmds' = map (newcmd $ unwords opts) cmds
dispatch False (cmd : params') cmds' options fields header $ dispatch False (cmd : params') cmds' options fields header mkrepo
Git.Construct.repoAbsPath dir >>= Git.Construct.fromAbsPath
where where
addrsyncopts opts seek k = setField "RsyncOptions" opts >> seek k addrsyncopts opts seek k = setField "RsyncOptions" opts >> seek k
newcmd opts c = c { cmdseek = addrsyncopts opts (cmdseek c) } newcmd opts c = c { cmdseek = addrsyncopts opts (cmdseek c) }
mkrepo = do
r <- Git.Construct.repoAbsPath dir >>= Git.Construct.fromAbsPath
Git.Config.read r
`catchIO` \_ -> do
hn <- fromMaybe "unknown" <$> getHostname
error $ "failed to read git config of git repository in " ++ hn ++ " on " ++ dir ++ "; perhaps this repository is not set up correctly or has moved"
external :: [String] -> IO () external :: [String] -> IO ()
external params = do external params = do

2
debian/changelog vendored
View file

@ -33,6 +33,8 @@ git-annex (5.2015022) UNRELEASED; urgency=medium
useful for things like ipfs that don't use regular urls. useful for things like ipfs that don't use regular urls.
* addurl: Added --raw option, which bypasses special handling of quvi, * addurl: Added --raw option, which bypasses special handling of quvi,
bittorrent etc urls. bittorrent etc urls.
* git-annex-shell: Improve error message when the specified repository
doesn't exist or git config fails for some reason.
-- Joey Hess <id@joeyh.name> Thu, 19 Feb 2015 14:16:03 -0400 -- Joey Hess <id@joeyh.name> Thu, 19 Feb 2015 14:16:03 -0400