← Back to task

Commit 26c66ca2

commit 26c66ca28a1f3581a765adebe1c0d79dd3512e3e
Author: Coder Agent <coder@agents.omni>
Date:   Wed Feb 11 22:29:08 2026

    Omni/Ide hooks: suppress zero-OID worktree checkout noise
    
    - avoid running tag diff logic when post-checkout old/new OID is all-zero
    - short-circuit branchless post-checkout processing in linked worktrees
    - guard branchless post-checkout for zero/non-commit revisions
    - harden reference-transaction hook by skipping zero-OID transactions
    
    Task-Id: t-576

diff --git a/Omni/Ide/hooks/post-checkout b/Omni/Ide/hooks/post-checkout
index 2c344c15..c5789b26 100755
--- a/Omni/Ide/hooks/post-checkout
+++ b/Omni/Ide/hooks/post-checkout
@@ -6,20 +6,25 @@ set -e
 env_loaded=true
 source "$(dirname "$0")/ensure-env.sh" || env_loaded=false
 
+old=$1
+new=$2
+z40=0000000000000000000000000000000000000000
+
 if [[ "$env_loaded" == "true" ]]; then
   function MakeTags {
     "${CODEROOT}"/Omni/Ide/MakeTags.py
   }
-  old=$1
-  new=$2
-  # filter out only the changed haskell files
-  mapfile -t changed < <(git diff --diff-filter=d --name-only "$old" "$new" -- '*.hs')
-  if [[ ! -r tags ]] || [[ ! -r TAGS ]]
-  then
-      MakeTags "$CODEROOT"/**/*
-  elif [[ ${#changed[@]} -gt 0 ]]
-  then
-      MakeTags "${changed[@]}"
+
+  if [[ "$old" != "$z40" && "$new" != "$z40" ]]; then
+    # filter out only the changed haskell files
+    mapfile -t changed < <(git diff --diff-filter=d --name-only "$old" "$new" -- '*.hs')
+    if [[ ! -r tags ]] || [[ ! -r TAGS ]]
+    then
+        MakeTags "$CODEROOT"/**/*
+    elif [[ ${#changed[@]} -gt 0 ]]
+    then
+        MakeTags "${changed[@]}"
+    fi
   fi
 else
   echo "warn: post-checkout: environment not available, skipping tag generation"
@@ -27,5 +32,22 @@ fi
 
 ## START BRANCHLESS CONFIG
 
+# In linked worktrees, branchless post-checkout hooks are noisy during branch
+# creation (`git worktree add`) and not required for workflow operation.
+if [[ "$(git rev-parse --git-dir 2>/dev/null || true)" == *"/worktrees/"* ]]; then
+  exit 0
+fi
+
+# git worktree add can invoke post-checkout with a zero OID old value.
+# branchless currently prints noisy fatal errors in that path.
+if [[ "$old" == "$z40" || "$new" == "$z40" ]]; then
+  exit 0
+fi
+
+# Guard against non-commit revisions in hook args.
+if ! git cat-file -e "$old^{commit}" 2>/dev/null || ! git cat-file -e "$new^{commit}" 2>/dev/null; then
+  exit 0
+fi
+
 git branchless hook post-checkout "$@"
 ## END BRANCHLESS CONFIG