Ævar Arnfjörð Bjarmason <[email protected]> writes:
> If the $cmdline variable contains multiple arguments they won't be
> interpolated correctly since the body of the test is single quoted. I
> don't know what part of test-lib.sh is expanding variables within
> single-quoted strings,...
dothis='echo whatever $IFS separated strings'
test_expect_success label '
$dothis
'
works because test_expect_success ends up beint a glorified 'eval'
and it sees the value of $dothis.
> but interpolating this inline is the desired
> behavior here.
I am not sure what you meant by this, though.
> - git fetch $cmdline &&
> + git fetch '"$cmdline"' &&
Would this work with cmdline that needs to be quoted for the
resulting shell script to be syntactically correct (e.g. cmdline
with a single dq in it)? By stepping out of sq pair, you are
allowing/asking the shell that forms test_expect_success command
line arguments to interpolate cmdline, instead of asking the shell
that evals test_expect_success with its command line argument
strings.
In other words, I suspect that the caller of test_configured_prune
now must sq_quote the cmdline arguments it passes to this helper,
i.e.
cmdline="$(git rev-parse --sq-quote arg1 'arg"2' arg3)"
test_configured_prune ... "$cmdline" ...
for this patch to be correct.