Skip to content

Commit bb0a3a2

Browse files
committed
fix(init): resolve broken merge in bash/zsh fzf blocks
The merge of main into fix-open-ai inserted new --expect code above the existing porcelain/empty-state logic instead of replacing it, leaving a dangling _gtr_selection subshell and duplicate variable declarations that produced syntax errors in the generated shell code. Move the _gtr_key/_gtr_line declarations to after the empty-state guard and remove the orphaned half-finished assignment lines so bash -n passes cleanly on the generated init output.
1 parent 748115b commit bb0a3a2

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

lib/commands/init.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ __FUNC__() {
8383
shift
8484
local dir
8585
if [ "$#" -eq 0 ] && command -v fzf >/dev/null 2>&1; then
86-
local _gtr_selection _gtr_key _gtr_line
87-
_gtr_selection="$(command git gtr list --porcelain | fzf \
8886
local _gtr_porcelain
8987
_gtr_porcelain="$(command git gtr list --porcelain)"
9088
if [ "$(printf '%s\n' "$_gtr_porcelain" | wc -l)" -le 1 ]; then
9189
echo "No worktrees to pick from. Create one with: git gtr new <branch>" >&2
9290
return 0
9391
fi
94-
local _gtr_selection
92+
local _gtr_selection _gtr_key _gtr_line
9593
_gtr_selection="$(printf '%s\n' "$_gtr_porcelain" | fzf \
9694
--delimiter=$'\t' \
9795
--with-nth=2 \
@@ -201,15 +199,13 @@ __FUNC__() {
201199
shift
202200
local dir
203201
if [ "$#" -eq 0 ] && command -v fzf >/dev/null 2>&1; then
204-
local _gtr_selection _gtr_key _gtr_line
205-
_gtr_selection="$(command git gtr list --porcelain | fzf \
206202
local _gtr_porcelain
207203
_gtr_porcelain="$(command git gtr list --porcelain)"
208204
if [ "$(printf '%s\n' "$_gtr_porcelain" | wc -l)" -le 1 ]; then
209205
echo "No worktrees to pick from. Create one with: git gtr new <branch>" >&2
210206
return 0
211207
fi
212-
local _gtr_selection
208+
local _gtr_selection _gtr_key _gtr_line
213209
_gtr_selection="$(printf '%s\n' "$_gtr_porcelain" | fzf \
214210
--delimiter=$'\t' \
215211
--with-nth=2 \

0 commit comments

Comments
 (0)