From 11d95581fb178a5d21e88dfd8030a61886cc2519 Mon Sep 17 00:00:00 2001
From: Ben Sima <ben@bsima.me>
Date: Wed, 3 Apr 2024 11:27:42 -0400
Subject: 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.
---
 Biz/Bild.hs | 17 ++++++-----------
 1 file 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
-- 
cgit v1.2.3