diff options
-rw-r--r-- | CmdLine.hs | 11 | ||||
-rw-r--r-- | Git/AutoCorrect.hs | 4 | ||||
-rw-r--r-- | debian/changelog | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/CmdLine.hs b/CmdLine.hs index a8d071ddf..606390130 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -26,6 +26,7 @@ import Common.Annex import qualified Annex import qualified Git import qualified Git.AutoCorrect +import qualified Git.Config import Annex.Content import Annex.Environment import Command @@ -44,7 +45,8 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do state <- Annex.new g Annex.eval state $ do checkEnvironment - checkfuzzy + when fuzzy $ + inRepo $ autocorrect . Just forM_ fields $ uncurry Annex.setField when (cmdnomessages cmd) $ Annex.setOutput QuietOutput @@ -54,13 +56,14 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do startup performCommandAction cmd params shutdown $ cmdnocommit cmd - go _flags params (Left e) = + go _flags params (Left e) = do + when fuzzy $ + autocorrect =<< Git.Config.global maybe (throw e) (\a -> a params) (cmdnorepo cmd) err msg = msg ++ "\n\n" ++ usage header allcmds cmd = Prelude.head cmds (fuzzy, cmds, name, args) = findCmd fuzzyok allargs allcmds err - checkfuzzy = when fuzzy $ - inRepo $ Git.AutoCorrect.prepare name cmdname cmds + autocorrect = Git.AutoCorrect.prepare name cmdname cmds {- Parses command line params far enough to find the Command to run, and - returns the remaining params. diff --git a/Git/AutoCorrect.hs b/Git/AutoCorrect.hs index aa8379849..ecc64e036 100644 --- a/Git/AutoCorrect.hs +++ b/Git/AutoCorrect.hs @@ -41,9 +41,9 @@ fuzzymatches input showchoice choices = fst $ unzip $ {- Takes action based on git's autocorrect configuration, in preparation for - an autocorrected command being run. -} -prepare :: String -> (c -> String) -> [c] -> Repo -> IO () +prepare :: String -> (c -> String) -> [c] -> Maybe Repo -> IO () prepare input showmatch matches r = - case readish $ Git.Config.get "help.autocorrect" "0" r of + case readish . Git.Config.get "help.autocorrect" "0" =<< r of Just n | n == 0 -> list | n < 0 -> warn diff --git a/debian/changelog b/debian/changelog index 9e5dfcf8c..a0edeb0ee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ git-annex (5.20140818) UNRELEASED; urgency=medium * When accessing a local remote, shut down git-cat-file processes afterwards, to ensure that remotes on removable media can be unmounted. Closes: #758630 + * Fix handing of autocorrection when running outside a git repository. -- Joey Hess <joeyh@debian.org> Tue, 19 Aug 2014 12:52:41 -0400 |