From 17a18df10a576ad8ffc54524b21ae3b4feb7becd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 23 Aug 2014 16:51:33 -0700 Subject: Fix handing of autocorrection when running outside a git repository. Old behavior was to take the first fuzzy match. Now, it checks the globa git config, and runs the normal fuzzy handling, including failing to run a semi-random command by default. --- Git/AutoCorrect.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Git/AutoCorrect.hs') 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 -- cgit v1.2.3