diff options
-rw-r--r-- | Biz/Bild.hs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 15d9619..0ebcfcb 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -202,7 +202,7 @@ move args = Cli.getAllArgs args (Cli.argument "target") |> filterM Dir.doesFileExist +> filterM (\x -> isGitIgnored x /> don't) - +> filterM (\x -> isGitHook root x /> don't) + /> filter (\x -> isGitHook x |> don't) +> traverse Dir.makeAbsolute +> traverse (namespaceFromPathOrDie root) +> foldM analyze mempty @@ -277,12 +277,9 @@ test_isGitIgnored = +> (@=? [False, True]) ] -isGitHook :: FilePath -> FilePath -> IO Bool -isGitHook root path = - Process.readProcess "git" ["config", "--local", "core.hooksPath"] "" - /> strip - /> stripRoot root - /> flip List.isInfixOf path +isGitHook :: FilePath -> Bool +isGitHook path = + "Biz/Ide/hooks" `List.isInfixOf` path test_isGitHook :: Test.Tree test_isGitHook = @@ -290,12 +287,10 @@ test_isGitHook = "isGitHook" [ Test.unit "filters pre-commit hook" <| do root <- Env.getEnv "CODEROOT" - res <- isGitHook root <| root <> "/Biz/Ide/hooks/pre-commit" - res @=? True, + True @=? (isGitHook <| root <> "/Biz/Ide/hooks/pre-commit"), Test.unit "doesn't filter non-hooks" <| do root <- Env.getEnv "CODEROOT" - res <- isGitHook root <| root <> "/Biz/Bild.hs" - res @=? False + False @=? (isGitHook <| root <> "/Biz/Bild.hs") ] namespaceFromPathOrDie :: FilePath -> FilePath -> IO Namespace |