summaryrefslogtreecommitdiff
path: root/Biz/Bild.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-04-03 11:27:42 -0400
committerBen Sima <ben@bsima.me>2024-04-03 16:18:12 -0400
commit11d95581fb178a5d21e88dfd8030a61886cc2519 (patch)
tree3effb8537914f7b15ba47d3fbb4c432951e3e073 /Biz/Bild.hs
parent6534e188843da5a5be7342b9a2a189ccc80d3268 (diff)
Hardcode hooksPath in bild
This seems to be needed for git test to work, specifically because in a new worktree, git is not configured, and direnv is not loaded to auto-configure these settings. At least that's as far as I can tell what's going on. In either case, best not to rely too much on git anyway.
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r--Biz/Bild.hs17
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