Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix: use `git rev-parse` to detect git repository instead of libgit2

Steven Enamakel69f75cb546d7
diff --git a/src/openhuman/tools/impl/filesystem/git_operations.rs b/src/openhuman/tools/impl/filesystem/git_operations.rs
index 71c793085a..e191a0201b 100644
--- a/src/openhuman/tools/impl/filesystem/git_operations.rs
+++ b/src/openhuman/tools/impl/filesystem/git_operations.rs
@@ -537,7 +537,11 @@ impl GitOperationsTool {
// Validate the repository instead of trusting the presence of a `.git`
// path. This handles linked-worktree gitfiles and rejects malformed
// ancestor markers that Git itself cannot open.
- if git2::Repository::discover(&effective_dir).is_err() {
+ let is_worktree = self
+ .run_git_command_in(&effective_dir, &["rev-parse", "--is-inside-work-tree"])
+ .await
+ .is_ok_and(|output| output.trim() == "true");
+ if !is_worktree {
return Ok(ToolResult::error("Not in a git repository"));
}