Skip to content

Comments

feat: add wt.relative config and --relative flag to append subdirectory to worktree path#113

Merged
k1LoW merged 1 commit intomainfrom
relpath
Feb 6, 2026
Merged

feat: add wt.relative config and --relative flag to append subdirectory to worktree path#113
k1LoW merged 1 commit intomainfrom
relpath

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Feb 6, 2026

This pull request introduces a new feature that allows the git wt command to append the current subdirectory path to the worktree output path, similar to git diff --relative. This behavior can be enabled via the wt.relative config or the --relative flag, and includes robust handling and documentation. Comprehensive tests are also added to ensure correct functionality and fallback behavior.

New feature: relative worktree path resolution

  • Added the wt.relative config option and --relative flag to enable appending the current subdirectory path to the worktree output path; includes fallback to worktree root if the subdirectory does not exist in the target worktree. (cmd/root.go, internal/git/config.go, README.md) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Implemented the resolveRelative function to handle path resolution logic, using the new ShowPrefix helper to determine the subdirectory relative to the repo root. (cmd/root.go, internal/git/config.go) [1] [2]

Shell completion

  • Included the --relative flag in shell completion options for improved usability. (e2e/config_test.go)

closes #106

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Code Metrics Report

main (703b66f) #113 (c76ad07) +/-
Coverage 38.6% 38.4% -0.2%
Code to Test Ratio 1:1.9 1:2.0 +0.0
Test Execution Time 13s 13s 0s
Details
  |                     | main (703b66f) | #113 (c76ad07) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          38.6% |          38.4% | -0.2% |
  |   Files             |             11 |             11 |     0 |
  |   Lines             |            834 |            858 |   +24 |
+ |   Covered           |            322 |            330 |    +8 |
+ | Code to Test Ratio  |          1:1.9 |          1:2.0 |  +0.0 |
  |   Code              |           1872 |           1917 |   +45 |
+ |   Test              |           3696 |           3837 |  +141 |
  | Test Execution Time |            13s |            13s |    0s |

Code coverage of files in pull request scope (20.9% → 21.7%)

Files Coverage +/- Status
cmd/root.go 0.0% 0.0% modified
internal/git/config.go 76.0% -0.4% modified

Reported by octocov

@k1LoW k1LoW marked this pull request as ready for review February 6, 2026 06:15
@k1LoW k1LoW added enhancement New feature or request tagpr:minor labels Feb 6, 2026
@k1LoW k1LoW merged commit 9362a49 into main Feb 6, 2026
3 checks passed
@k1LoW k1LoW deleted the relpath branch February 6, 2026 08:39
@github-actions github-actions bot mentioned this pull request Feb 6, 2026
@yermulnik
Copy link

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tagpr:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: on wt creation output path to wt including path of the current subdirectory

2 participants