diff options
| author | Luke Shumaker <lukeshu@datawire.io> | 2021-04-27 15:17:36 -0600 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-04-28 16:47:18 +0900 |
| commit | a94f911072eb096184d3b4daeb58722dc339d0d9 (patch) | |
| tree | cf0ed8e5189be60592547d4283213a1e78c326a9 /t/t4018/cpp-function-returning-pointer | |
| parent | subtree: use more explicit variable names for cmdline args (diff) | |
| download | git-a94f911072eb096184d3b4daeb58722dc339d0d9.tar.gz git-a94f911072eb096184d3b4daeb58722dc339d0d9.zip | |
subtree: use "$*" instead of "$@" as appropriate
"$*" is for when you want to concatenate the args together,
whitespace-separated; and "$@" is for when you want them to be separate
strings.
There are several places in subtree that erroneously use $@ when
concatenating args together into an error message.
For instance, if the args are argv[1]="dead" and argv[2]="beef", then
the line
die "You must provide exactly one revision. Got: '$@'"
surely intends to call 'die' with the argument
argv[1]="You must provide exactly one revision. Got: 'dead beef'"
however, because the line used $@ instead of $*, it will actually call
'die' with the arguments
argv[1]="You must provide exactly one revision. Got: 'dead"
argv[2]="beef'"
This isn't a big deal, because 'die' concatenates its arguments together
anyway (using "$*"). But that doesn't change the fact that it was a
mistake to use $@ instead of $*, even though in the end $@ still ended
up doing the right thing.
Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018/cpp-function-returning-pointer')
0 files changed, 0 insertions, 0 deletions
