Bug: worktree creation creates bare repos instead of proper worktrees #57
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
{"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\nInskills/kugetsu/scripts/kugetsu, functioncreate_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 --barecreates a bare repository (no working directory), which is useless for development.\n\n## Expected Behavior\n\nProper worktree should have:\n-.gitfile (not directory) pointing to main repo\n- Actual working directory with files\n- Linked to main repo viagit 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- Allkugetsu startcommands fail to create usable worktrees\n\n## Reproduction\n\n1. Runkugetsu 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\nChangegit clone --baretogit cloneincreate_worktree()function."}