Re: [PATCH v5 3/3] run-command: show prepared command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ian Wienand <iwienand@xxxxxxxxxx> writes:

> +test_expect_success 'tracing a shell alias with arguments shows trace of prepared command' '
> +	git config alias.echo "!echo \$*" &&
> +	env GIT_TRACE=1 git echo argument 2>output &&
> +	test_grep "^trace: start_command:.*" output
> +'

This will succeed even if you have two or more instances of this
log, which will not help you avoid the mistake we saw in an earlier
iteration.

How about making sure that the prepared command looks reasonable
enough and we have only one, by doing something like this?

test_expect_success 'tracing a shell alias with arg shows trace of prepared command' '
	cat >expect <<-EOF &&
	trace: prepare_cmd: SHELL -c ${SQ}echo \$* "\$@"${SQ} ${SQ}echo \$*${SQ} arg
	EOF
	git config alias.echo "!echo \$*" &&
	env GIT_TRACE=1 git echo arg 2>output &&
	# redact platform differences
	sed -n -e "s/^\(trace: prepare_cmd:\) .* -c /\1 SHELL -c /p" output >actual &&
	test_cmp expect actual
'

A sample run of CI job with the above change (and others I sent on
the list) can be seen at:

    https://github.com/git/git/actions/runs/9233329671

You can fetch 'seen' and can find commit 05ebf54569, which is the
tip of your topic including a few "fixup" commits I made on top.

  $ git log --decorate --oneline master..05ebf54569
  05ebf54569 (iw/trace-argv-on-alias) fixup! run-command: show prepared command
  11056975bb fixup! run-command: show prepared command
  770dda8f2b run-command: show prepared command
  242b9d4d63 Documentation: alias: add notes on shell expansion
  e4331ad0d4 Documentation: alias: rework notes into points

It hasn't finished running yet, but all the windows tests have
passed, so I'll happily go to bed now ;-)

Thanks.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux