aboutsummaryrefslogtreecommitdiff
path: root/Git/AutoCorrect.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-23 16:51:33 -0700
committerGravatar Joey Hess <joey@kitenet.net>2014-08-23 16:51:33 -0700
commit17a18df10a576ad8ffc54524b21ae3b4feb7becd (patch)
tree38b16a7a9cf26a74cb7e62bda663ef822790c2e5 /Git/AutoCorrect.hs
parent6759f6700c7c7645886909d052cb092a704f7d31 (diff)
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.
Diffstat (limited to 'Git/AutoCorrect.hs')
-rw-r--r--Git/AutoCorrect.hs4
1 files changed, 2 insertions, 2 deletions
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