summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-13 20:59:01 +0000
committersoryu <soryu@soryu.co>2026-02-13 20:59:01 +0000
commitc1e55ce4fec79f9909b957f86bd7fa8b76939746 (patch)
tree202b277add6aacc51f60b535cfcdcb6a4f249974
parentc2bad633593a8ec6ffa83d7ff10776560cf0f69f (diff)
downloadsoryu-c1e55ce4fec79f9909b957f86bd7fa8b76939746.tar.gz
soryu-c1e55ce4fec79f9909b957f86bd7fa8b76939746.zip
Directive task bare repo fix
-rw-r--r--makima/src/daemon/worktree/manager.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/makima/src/daemon/worktree/manager.rs b/makima/src/daemon/worktree/manager.rs
index 04180b8..5df9a73 100644
--- a/makima/src/daemon/worktree/manager.rs
+++ b/makima/src/daemon/worktree/manager.rs
@@ -864,15 +864,25 @@ impl WorktreeManager {
if git_file.is_file() {
let content = tokio::fs::read_to_string(&git_file).await?;
- // Format: "gitdir: /path/to/repo/.git/worktrees/name"
+ // Format varies by repo type:
+ // Non-bare: "gitdir: /path/to/repo/.git/worktrees/name"
+ // Bare: "gitdir: /path/to/bare-repo/worktrees/name"
if let Some(gitdir) = content.strip_prefix("gitdir: ") {
let gitdir = gitdir.trim();
- // Navigate from worktrees/name back to the main repo
let path = PathBuf::from(gitdir);
+ // Navigate up from worktrees/name to the git directory
if let Some(worktrees_dir) = path.parent() {
if let Some(git_dir) = worktrees_dir.parent() {
- if let Some(repo_dir) = git_dir.parent() {
- return Ok(repo_dir.to_path_buf());
+ // For bare repos, git_dir IS the repo (e.g. ~/.makima/repos/foo/)
+ // For non-bare repos, git_dir is <repo>/.git/, need one more parent
+ if git_dir.file_name() == Some(std::ffi::OsStr::new(".git")) {
+ // Non-bare: go up from .git/ to the repo root
+ if let Some(repo_dir) = git_dir.parent() {
+ return Ok(repo_dir.to_path_buf());
+ }
+ } else {
+ // Bare repo: git_dir is already the repo
+ return Ok(git_dir.to_path_buf());
}
}
}