Commit graph

14 commits

Author SHA1 Message Date
Chris Monardo 8a99bf1670 Make ghq rm worktree-aware
ghq rm previously used os.RemoveAll with no worktree awareness, which
caused two problems: removing a linked worktree left a dangling entry
in the parent repo's .git/worktrees/, and removing a repo that had
linked worktrees orphaned all of them.

Now ghq rm detects both scenarios:
- If the target is a linked worktree, use git worktree remove to
  properly unregister it from the parent repo.
- If the target repo has linked worktrees, prune each one before
  removing the main repo.

Extract shared worktree helpers into worktree.go so both cmd_rm.go
and cmd_migrate.go can reuse them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 02:57:37 -04:00
Zhizhen He 7dff4b0aa8 Update urfave/cli/v2 to v3 2026-03-19 14:16:12 +08:00
copilot-swe-agent[bot] 46be3fa40c Fix worktree migration path handling on Windows
The repairWorktreeBackPointers function was failing to detect internal
worktrees on Windows because Git writes paths with forward slashes in
gitdir files, but the code was comparing them with backslash paths.

- Normalize oldDir to forward slashes for comparison
- Normalize wtPath read from gitdir file for comparison
- Write updated gitdir with forward slashes (Git's format)
- Fix wtDir trimming to use forward slash separator

This fixes both the back-pointer repair and the paths passed to
'git worktree repair' on Windows.

Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-17 07:30:11 +00:00
atusy 17a1d6216e feat(migrate): make worktree and submodule aware
The migrate command had no awareness of Git worktrees or submodules,
which are linked checkouts with a .git file referencing a parent repo.

This adds three capabilities:

- Detects linked checkouts (.git file with gitdir: reference) and
  refuses migration with a descriptive error, since moving them
  independently always breaks the link.

- After migrating a repo with linked worktrees, runs
  'git worktree repair' to update forward references (worktree .git
  files) back to the new main repo location.

- Handles internal worktrees (inside the repo directory) by rewriting
  stale back-pointers (.git/worktrees/*/gitdir) before repair, since
  both directions become stale when the worktree moves with the repo.
2026-02-15 18:54:31 +09:00
copilot-swe-agent[bot] 483e6fd0b4 Replace custom copy implementation with otiai10/copy library
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-14 07:43:12 +00:00
Masayuki Matsuki 5bb07f7c74
Update cmd_migrate.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-14 16:30:02 +09:00
Masayuki Matsuki af48fe25ac
Update cmd_migrate.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-14 16:29:22 +09:00
copilot-swe-agent[bot] d17d6c2257
Fix permission bits and add test error handling
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-14 16:05:38 +09:00
copilot-swe-agent[bot] 351082d1ed
Address code review feedback: improve error handling and permission bits
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-14 16:05:38 +09:00
copilot-swe-agent[bot] 875224e621
Add cross-device move support with EXDEV fallback
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-14 16:05:38 +09:00
copilot-swe-agent[bot] 9515744ee5 Add RemoteURL field to VCSBackend and implement for all backends
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-13 17:35:14 +00:00
copilot-swe-agent[bot] 4010026f51 Format code with goimports and go fmt
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-13 17:01:03 +00:00
copilot-swe-agent[bot] 929852152e Improve error message for user-aborted migration
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-13 16:50:54 +00:00
copilot-swe-agent[bot] 9503ad3620 Add migrate subcommand implementation
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
2026-02-13 16:48:07 +00:00