Skip to content

Commit 73a5368

Browse files
committed
fix: correct fish gtrconfig path regex
1 parent 57eb199 commit 73a5368

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

lib/commands/init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function __FUNC___gtrconfig_path
176176
test -n "$_gtr_repo_root"; or return 1
177177
printf '%s/.gtrconfig\n' "$_gtr_repo_root"
178178
else
179-
printf '%s/.gtrconfig\n' (string replace -r '/\\.git$' '' -- "$_gtr_git_common_dir")
179+
printf '%s/.gtrconfig\n' (string replace -r '/\.git$' '' -- "$_gtr_git_common_dir")
180180
end
181181
end
182182

tests/init.bats

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,21 @@ require_runtime_shell() {
305305
[[ "$output" == *'cat "$_gtr_trust_path"'* ]]
306306
}
307307

308+
@test "fish output strips linked-worktree git common dir suffix" {
309+
require_runtime_shell fish
310+
311+
run cmd_init fish
312+
[ "$status" -eq 0 ]
313+
314+
local pattern
315+
pattern=$(printf '%s\n' "$output" | sed -n "s/.*string replace -r '\([^']*\)'.*/\1/p" | head -n 1)
316+
[ "$pattern" = '/\.git$' ]
317+
318+
run fish -c 'string replace -r -- $argv[1] "" /tmp/repo/.git' -- "$pattern"
319+
[ "$status" -eq 0 ]
320+
[ "$output" = "/tmp/repo" ]
321+
}
322+
308323
# ── new --cd wrapper support ────────────────────────────────────────────────
309324

310325
@test "bash output intercepts new --cd and strips flag before delegating" {

0 commit comments

Comments
 (0)