cmd_start clones from wrong URL — get_repo_url strips user/org from path #181

Closed
opened 2026-04-06 05:52:46 +02:00 by shoko · 0 comments
Owner

Bug

get_repo_url() in kugetsu-worktree.sh constructs repo URL incorrectly for issue refs of the form instance/user/repo#number.

Root cause: Line 44 uses sed 's/.*\///' which removes everything up to the LAST slash. For git.fbrns.co/shoko/kugetsu#158:

  • Expected rest = shoko/kugetsu
  • Actual rest = kugetsu (last path component only)

This makes the function output https://git.fbrns.co/kugetsu.git instead of https://git.fbrns.co/shoko/kugetsu.git.

Affected versions: v0.2.8

Reproduction

git clone https://git.fbrns.co/kugetsu.git /tmp/test-clone
# remote: Not found.
# fatal: repository not found

Fix

Replace line 44:

# WRONG — strips to last path component only
rest=$(echo "$issue_ref" | sed 's/.*\///' | sed 's/#.*//')

# CORRECT — strips instance prefix, preserves user/repo
rest=$(echo "$issue_ref" | sed 's/^[^/]*\///' | sed 's/#.*//')

For git.fbrns.co/shoko/kugetsu#158:

  • sed 's/^[^/]*\///'shoko/kugetsu#158
  • sed 's/#.*//'shoko/kugetsu
## Bug get_repo_url() in kugetsu-worktree.sh constructs repo URL incorrectly for issue refs of the form `instance/user/repo#number`. **Root cause:** Line 44 uses `sed 's/.*\///'` which removes everything up to the LAST slash. For `git.fbrns.co/shoko/kugetsu#158`: - Expected `rest = shoko/kugetsu` - Actual `rest = kugetsu` (last path component only) This makes the function output `https://git.fbrns.co/kugetsu.git` instead of `https://git.fbrns.co/shoko/kugetsu.git`. **Affected versions:** v0.2.8 ## Reproduction ```bash git clone https://git.fbrns.co/kugetsu.git /tmp/test-clone # remote: Not found. # fatal: repository not found ``` ## Fix Replace line 44: ```bash # WRONG — strips to last path component only rest=$(echo "$issue_ref" | sed 's/.*\///' | sed 's/#.*//') # CORRECT — strips instance prefix, preserves user/repo rest=$(echo "$issue_ref" | sed 's/^[^/]*\///' | sed 's/#.*//') ``` For `git.fbrns.co/shoko/kugetsu#158`: - `sed 's/^[^/]*\///'` → `shoko/kugetsu#158` - `sed 's/#.*//'` → `shoko/kugetsu` ✓
shoko added the bug label 2026-04-06 05:52:46 +02:00
shoko closed this issue 2026-04-06 07:08: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#181