Skip to content

Commit f264c05

Browse files
committed
Some cleanup
1 parent a88d56e commit f264c05

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

  • bin/common/.local/bin

bin/common/.local/bin/cwt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ if [ ! -d "$GIT_SRC_WORKTREE_DIR" ]; then
104104
exit 1
105105
fi
106106

107-
if [ "$use_tmux" = off ]; then
108-
use_codex=off
109-
fi
110-
111107
if [ "$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
121119
fi
122120

123121
if [ "$use_codex" = on ] && ! command -v codex >/dev/null 2>&1; then
@@ -139,6 +137,7 @@ fi
139137

140138
if [ -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"
156155
worktree_path="$repo_worktree_dir/$feature_name"
157156
session_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-
163158
if [ -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"
180175
git worktree add -b "$branch_name" "$worktree_path" "$base_ref"
181176

182177
if [ "$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

Comments
 (0)