@@ -104,10 +104,6 @@ if [ ! -d "$GIT_SRC_WORKTREE_DIR" ]; then
104104 exit 1
105105fi
106106
107- if [ " $use_tmux " = off ]; then
108- use_codex=off
109- fi
110-
111107if [ " $use_tmux " = on ]; then
112108 if ! command -v tmux > /dev/null 2>&1 ; then
113109 echo " tmux is not installed." >&2
@@ -118,6 +114,8 @@ if [ "$use_tmux" = on ]; then
118114 echo " EDITOR is not set." >&2
119115 exit 1
120116 fi
117+ else
118+ use_codex=off
121119fi
122120
123121if [ " $use_codex " = on ] && ! command -v codex > /dev/null 2>&1 ; then
139137
140138if [ -z " $base_ref " ]; then
141139 base_ref=" $( git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2> /dev/null | sed ' s@^origin/@@' ) "
140+
142141 if [ -z " $base_ref " ]; then
143142 echo " Could not determine the default branch from refs/remotes/origin/HEAD." >&2
144143 exit 1
@@ -156,10 +155,6 @@ repo_worktree_dir="$GIT_SRC_WORKTREE_DIR/$repo_name"
156155worktree_path=" $repo_worktree_dir /$feature_name "
157156session_name=" $( cw_session_name " $repo_name " " $feature_name " ) "
158157
159- if [ " $use_codex " = on ]; then
160- printf -v codex_command ' codex fork --all --cd %q' " $worktree_path "
161- fi
162-
163158if [ -e " $worktree_path " ]; then
164159 echo " Worktree path already exists: $worktree_path " >&2
165160 exit 1
@@ -180,6 +175,8 @@ mkdir -p "$repo_worktree_dir"
180175git worktree add -b " $branch_name " " $worktree_path " " $base_ref "
181176
182177if [ " $use_tmux " = on ]; then
178+ printf -v codex_command ' codex fork --all --cd %q' " $worktree_path "
179+
183180 tmux new-session -s " $session_name " -n repo -d -c " $worktree_path "
184181 tmux set-option -t " $session_name " @display_name " $feature_name "
185182
0 commit comments