ADFA-2591 Updating flox hooks for git worktree compatibility#863
Conversation
📝 WalkthroughRelease NotesGit Worktree Compatibility for Flox HooksChanges:
Benefits:
Risks & Best Practices:
Compatibility:
WalkthroughThe manifest.toml file's git hook installation logic is refactored to validate git repository status, dynamically compute the hooks directory path, and conditionally update hooks only when necessary or missing, replacing the previous hardcoded .git/hooks approach. Changes
Sequence DiagramsequenceDiagram
participant Manifest as Manifest Processor
participant Git as Git System
participant FS as Filesystem
Manifest->>Git: Check if git repository exists<br/>(git rev-parse --git-dir)
alt Git Repo Found
Git-->>Manifest: Return success
Manifest->>Git: Compute hooks directory<br/>(git rev-parse --git-common-dir)
Git-->>Manifest: Return hooks_dir path
Manifest->>FS: Create hooks directory
FS-->>Manifest: Directory ready
Manifest->>FS: Check pre-commit hook exists<br/>or lacks COGO_GIT_HOOK marker
FS-->>Manifest: Hook status
alt Hook Missing or Marker Absent
Manifest->>FS: Write hook script
FS-->>Manifest: Hook written
Manifest->>FS: chmod +x hook file
FS-->>Manifest: Permissions set
end
Manifest->>FS: Check pre-push hook exists<br/>or lacks COGO_GIT_HOOK marker
FS-->>Manifest: Hook status
alt Hook Missing or Marker Absent
Manifest->>FS: Write hook script
FS-->>Manifest: Hook written
Manifest->>FS: chmod +x hook file
FS-->>Manifest: Permissions set
end
else Not a Git Repo
Git-->>Manifest: Return error
Manifest->>Manifest: Skip hook installation
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Our current flox setup has two hooks: pre-commit and pre-push. We were assuming they could only be installed under the .git/ directory. Git worktrees convert the .git/ directory into a file of the same name. This breaks our old hook installation approach.
Git worktrees are helpful when working on multiple Jira tickets at the same time. Perhaps with an AI orchestration system like Gas Town.