summaryrefslogtreecommitdiff
path: root/contrib/subtree/git-subtree.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2021-04-27 21:17:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-28 07:47:18 (GMT)
commita94f911072eb096184d3b4daeb58722dc339d0d9 (patch)
treecf0ed8e5189be60592547d4283213a1e78c326a9 /contrib/subtree/git-subtree.sh
parente2b11e42110f3c7082b4a5547eb535b0be6153e5 (diff)
downloadgit-a94f911072eb096184d3b4daeb58722dc339d0d9.zip
git-a94f911072eb096184d3b4daeb58722dc339d0d9.tar.gz
git-a94f911072eb096184d3b4daeb58722dc339d0d9.tar.bz2
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 'contrib/subtree/git-subtree.sh')
-rwxr-xr-xcontrib/subtree/git-subtree.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index d7de4b0..3105eb8 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -58,14 +58,14 @@ progress () {
assert () {
if ! "$@"
then
- die "assertion failed: " "$@"
+ die "assertion failed: $*"
fi
}
ensure_single_rev () {
if test $# -ne 1
then
- die "You must provide exactly one revision. Got: '$@'"
+ die "You must provide exactly one revision. Got: '$*'"
fi
}
@@ -690,7 +690,7 @@ cmd_add () {
cmd_add_repository "$@"
else
- say >&2 "error: parameters were '$@'"
+ say >&2 "error: parameters were '$*'"
die "Provide either a commit or a repository and commit."
fi
}