Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-05-11 00:07:10 +0300
committerJunio C Hamano <gitster@pobox.com>2016-05-11 00:11:27 +0300
commit8e98b35f87532761f09101729715c2ec49e24ddf (patch)
tree5ad949544756ad5638e5d57376bd037eb783c3f7 /git-rebase--interactive.sh
parentd92347f59fefb95a2d9240c007a44f408c216fa7 (diff)
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 <megabreit@googlemail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r--git-rebase--interactive.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4cde685b43a..655ebaa4717 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -82,6 +82,7 @@ rewritten_pending="$state_dir"/rewritten-pending
cr=$(printf "\015")
strategy_args=${strategy:+--strategy=$strategy}
+test -n "$strategy_opts" &&
eval '
for strategy_opt in '"$strategy_opts"'
do