fix: get_repo_url() strips user/org from path (issue #181) #182

Merged
shoko merged 1 commits from fix/issue-181-get-repo-url-strips-user-org into main 2026-04-06 06:07:47 +02:00
Owner

Summary

  • Fixed get_repo_url() in kugetsu-worktree.sh where the sed pattern was removing everything up to the LAST slash instead of the FIRST slash
  • For issue ref git.fbrns.co/shoko/kugetsu#158:
    • Before: URL was https://git.fbrns.co/kugetsu.git (WRONG)
    • After: URL is https://git.fbrns.co/shoko/kugetsu.git (CORRECT)
  • Added comprehensive test suite test-git-url-parsing.sh covering all git URL parsing functions

Changes

  1. Bug fix (kugetsu-worktree.sh:44): Changed sed 's/.*\///' to sed 's/^[^\/]*\///'
  2. Tests (test-git-url-parsing.sh): New test file with 22 test cases for URL parsing

Test Coverage

  • get_repo_url() - constructs repo URLs from issue refs
  • issue_ref_to_worktree_name() - converts issue ref to worktree directory name
  • issue_ref_to_branch_name() - converts issue ref to branch name
  • extract_issue_ref_from_message() - extracts issue refs from messages/URLs
  • validate_issue_ref() - validates issue ref format
  • issue_ref_to_filename() / filename_to_issue_ref() - bidirectional conversion
## Summary - Fixed `get_repo_url()` in `kugetsu-worktree.sh` where the sed pattern was removing everything up to the LAST slash instead of the FIRST slash - For issue ref `git.fbrns.co/shoko/kugetsu#158`: - Before: URL was `https://git.fbrns.co/kugetsu.git` (WRONG) - After: URL is `https://git.fbrns.co/shoko/kugetsu.git` (CORRECT) - Added comprehensive test suite `test-git-url-parsing.sh` covering all git URL parsing functions ## Changes 1. **Bug fix** (`kugetsu-worktree.sh:44`): Changed `sed 's/.*\///'` to `sed 's/^[^\/]*\///'` 2. **Tests** (`test-git-url-parsing.sh`): New test file with 22 test cases for URL parsing ## Test Coverage - `get_repo_url()` - constructs repo URLs from issue refs - `issue_ref_to_worktree_name()` - converts issue ref to worktree directory name - `issue_ref_to_branch_name()` - converts issue ref to branch name - `extract_issue_ref_from_message()` - extracts issue refs from messages/URLs - `validate_issue_ref()` - validates issue ref format - `issue_ref_to_filename()` / `filename_to_issue_ref()` - bidirectional conversion
shoko added 1 commit 2026-04-06 06:05:48 +02:00
The sed pattern 's/.*\///' on line 44 was removing everything up to the
LAST slash, but for issue refs like 'git.fbrns.co/shoko/kugetsu#158' it
should remove the instance prefix only (up to the FIRST slash).

Before: git.fbrns.co/shoko/kugetsu#158 -> kugetsu (WRONG)
After:  git.fbrns.co/shoko/kugetsu#158 -> shoko/kugetsu (CORRECT)

Also adds comprehensive test suite for git URL parsing functions:
- get_repo_url(), issue_ref_to_worktree_name(), issue_ref_to_branch_name()
- extract_issue_ref_from_message(), validate_issue_ref()
- issue_ref_to_filename(), filename_to_issue_ref()
han approved these changes 2026-04-06 06:07:03 +02:00
han left a comment
First-time contributor

lgtm

lgtm
shoko merged commit 4f2a04e0b4 into main 2026-04-06 06:07:47 +02:00
Sign in to join this conversation.