From 3439ea4bdce387549a3d506817677ba80a0d63aa Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Mar 2015 21:45:42 -0400 Subject: [PATCH] git-annex-shell: Improve error message when the specified repository doesn't exist or git config fails for some reason. --- CmdLine/GitAnnexShell.hs | 10 ++++++++-- debian/changelog | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CmdLine/GitAnnexShell.hs b/CmdLine/GitAnnexShell.hs index b1b351e3b6..adf6da04e9 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 diff --git a/debian/changelog b/debian/changelog index a7deae107f..5c501c2f33 100644 --- a/debian/changelog +++ b/debian/changelog @@ -33,6 +33,8 @@ git-annex (5.2015022) UNRELEASED; urgency=medium useful for things like ipfs that don't use regular urls. * addurl: Added --raw option, which bypasses special handling of quvi, 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 Thu, 19 Feb 2015 14:16:03 -0400