diff options
author | 2015-03-05 21:45:42 -0400 | |
---|---|---|
committer | 2015-03-05 21:45:42 -0400 | |
commit | 00fbe488dd30ead25b8fa9798b6a5ca5011e6fc1 (patch) | |
tree | 2f0e2fb665946466acb1ef92752be214281a515a /CmdLine/GitAnnexShell.hs | |
parent | f8652a2ceac987dad5350dab04a92f8d0114823d (diff) |
git-annex-shell: Improve error message when the specified repository doesn't exist or git config fails for some reason.
Diffstat (limited to 'CmdLine/GitAnnexShell.hs')
-rw-r--r-- | CmdLine/GitAnnexShell.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/CmdLine/GitAnnexShell.hs b/CmdLine/GitAnnexShell.hs index b1b351e3b..adf6da04e 100644 --- a/CmdLine/GitAnnexShell.hs +++ b/CmdLine/GitAnnexShell.hs @@ -12,6 +12,7 @@ import System.Console.GetOpt import Common.Annex import qualified Git.Construct +import qualified Git.Config import CmdLine import Command import Annex.UUID @@ -101,11 +102,16 @@ builtin cmd dir params = do let (params', fieldparams, opts) = partitionParams params fields = filter checkField $ parseFields fieldparams cmds' = map (newcmd $ unwords opts) cmds - dispatch False (cmd : params') cmds' options fields header $ - Git.Construct.repoAbsPath dir >>= Git.Construct.fromAbsPath + dispatch False (cmd : params') cmds' options fields header mkrepo where addrsyncopts opts seek k = setField "RsyncOptions" opts >> seek k 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 params = do |