Skip to content

Commit 8e98b35

Browse files
peffgitster
authored andcommitted
rebase--interactive: avoid empty list in shell for-loop
The $strategy_opts variable contains a space-separated list of strategy options, each individually shell-quoted. To loop over each, we "unwrap" them by doing an eval like: eval ' for opt in '"$strategy_opts"' do ... done ' Note the quoting that means we expand $strategy_opts inline in the code to be evaluated (which is the right thing because we want the IFS-split and de-quoting). If the variable is empty, however, we ask the shell to eval the following code: for opt in do ... done without anything between "in" and "do". Most modern shells are happy to treat that like a noop, but reportedly ksh88 on AIX considers it a syntax error. So let's catch the case that the variable is empty and skip the eval altogether (since we know the loop would be a noop anyway). Reported-by: Armin Kunaschik <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d92347f commit 8e98b35

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

git-rebase--interactive.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ rewritten_pending="$state_dir"/rewritten-pending
8282
cr=$(printf "\015")
8383

8484
strategy_args=${strategy:+--strategy=$strategy}
85+
test -n "$strategy_opts" &&
8586
eval '
8687
for strategy_opt in '"$strategy_opts"'
8788
do

0 commit comments

Comments
 (0)