Bug: worktree creation creates bare repos instead of proper worktrees #57

Closed
opened 2026-04-01 01:14:48 +02:00 by shoko · 0 comments
Owner

{"title":"Bug: worktree creation creates bare repos instead of proper worktrees","body":"## Bug Description\n\nThe create_worktree() function in kugetsu creates bare repos instead of proper git worktrees, breaking parallel agent workflow.\n\n## Current Code (Broken)\n\nIn skills/kugetsu/scripts/kugetsu, function create_worktree():\n\nbash\ncreate_worktree() {\n ...\n echo \"Creating worktree at '$worktree_path'...\"\n git clone --bare \"$repo_url\" \"$worktree_path\" 2>/dev/null || {\n echo \"Error: Failed to clone repository\" >&2\n exit 1\n }\n ...\n}\n\n\ngit clone --bare creates a bare repository (no working directory), which is useless for development.\n\n## Expected Behavior\n\nProper worktree should have:\n- .git file (not directory) pointing to main repo\n- Actual working directory with files\n- Linked to main repo via git worktree add\n\n## Correct Implementation\n\nbash\ncreate_worktree() {\n local issue_ref=\"$1\"\n local worktree_path=$(issue_ref_to_worktree_path \"$issue_ref\")\n local branch_name=$(issue_ref_to_branch_name \"$issue_ref\")\n local repo_url=$(get_repo_url \"$issue_ref\")\n \n ...\n \n # Step 1: Clone the repo normally\n git clone \"$repo_url\" \"$worktree_path\" || {\n echo \"Error: Failed to clone repository\" >&2\n exit 1\n }\n \n # Step 2: Create a new branch in the worktree\n git -C \"$worktree_path\" checkout -b \"$branch_name\" || {\n echo \"Error: Failed to create branch\" >&2\n exit 1\n }\n \n echo \"Worktree created at: $worktree_path\"\n}\n\n\n## Impact\n\n- Dev agents cannot work in the created directories (no files, no working tree)\n- Parallel issue work is broken\n- All kugetsu start commands fail to create usable worktrees\n\n## Reproduction\n\n1. Run kugetsu start github.com/shoko/kugetsu#49 \"task\"\n2. Check ~/.kugetsu/worktrees/github.com-shoko-kugetsu-49/\n3. Observe it's a bare repo (has objects/, refs/, but no .git file and no working files)\n\n## Fix Required\n\nChange git clone --bare to git clone in create_worktree() function."}

{"title":"Bug: worktree creation creates bare repos instead of proper worktrees","body":"## Bug Description\n\nThe `create_worktree()` function in kugetsu creates bare repos instead of proper git worktrees, breaking parallel agent workflow.\n\n## Current Code (Broken)\n\nIn `skills/kugetsu/scripts/kugetsu`, function `create_worktree()`:\n\n```bash\ncreate_worktree() {\n ...\n echo \"Creating worktree at '$worktree_path'...\"\n git clone --bare \"$repo_url\" \"$worktree_path\" 2>/dev/null || {\n echo \"Error: Failed to clone repository\" >&2\n exit 1\n }\n ...\n}\n```\n\n`git clone --bare` creates a bare repository (no working directory), which is useless for development.\n\n## Expected Behavior\n\nProper worktree should have:\n- `.git` file (not directory) pointing to main repo\n- Actual working directory with files\n- Linked to main repo via `git worktree add`\n\n## Correct Implementation\n\n```bash\ncreate_worktree() {\n local issue_ref=\"$1\"\n local worktree_path=$(issue_ref_to_worktree_path \"$issue_ref\")\n local branch_name=$(issue_ref_to_branch_name \"$issue_ref\")\n local repo_url=$(get_repo_url \"$issue_ref\")\n \n ...\n \n # Step 1: Clone the repo normally\n git clone \"$repo_url\" \"$worktree_path\" || {\n echo \"Error: Failed to clone repository\" >&2\n exit 1\n }\n \n # Step 2: Create a new branch in the worktree\n git -C \"$worktree_path\" checkout -b \"$branch_name\" || {\n echo \"Error: Failed to create branch\" >&2\n exit 1\n }\n \n echo \"Worktree created at: $worktree_path\"\n}\n```\n\n## Impact\n\n- Dev agents cannot work in the created directories (no files, no working tree)\n- Parallel issue work is broken\n- All `kugetsu start` commands fail to create usable worktrees\n\n## Reproduction\n\n1. Run `kugetsu start github.com/shoko/kugetsu#49 \"task\"`\n2. Check `~/.kugetsu/worktrees/github.com-shoko-kugetsu-49/`\n3. Observe it's a bare repo (has objects/, refs/, but no .git file and no working files)\n\n## Fix Required\n\nChange `git clone --bare` to `git clone` in `create_worktree()` function."}
shoko added the critical label 2026-04-01 01:17:14 +02:00
shoko closed this issue 2026-04-01 02:59:43 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/kugetsu#57