"Shawn O. Pearce" [off-list ref] writes:
Junio C Hamano [off-list ref] wrote:
quoted
...
Do you really mean this? "printf %s 1 2 3" writes "123" without
terminating LF. You seem to check only for size but to be
reusable you might want to use something like:
The only thing we care about is was there args or not to the hook.
I probably could do that test differently, like say:
echo $# >$GIT_DIR/pre-receive.args
and then test that the file contains "0" instead of looking for it to
be empty. Not sure why I didn't write it that way in the beginning.
quoted
printf '%s\n' "$@"
Eh. Since all we care is that the argument count is 0 we probably
should be looking at $# and calling it a day.
I'll apply as-is, but once you break the code that calls
pre-receive hook in such a way that it sends unexpected
arguments, you'd thank me for suggesting to print the arguments
separately while debugging the problem with the test script.
Junio C Hamano [off-list ref] wrote:
"Shawn O. Pearce" [off-list ref] writes:
quoted
quoted
printf '%s\n' "$@"
Eh. Since all we care is that the argument count is 0 we probably
should be looking at $# and calling it a day.
I'll apply as-is, but once you break the code that calls
pre-receive hook in such a way that it sends unexpected
arguments, you'd thank me for suggesting to print the arguments
separately while debugging the problem with the test script.
Well, I don't really think it matters. I doubt we'll break that
code that invokes the pre-receive or post-receive hooks. And as
those hooks are defined to never take arguments if we did suddenly
start passing arguments we want the test to break. When tests break
sometimes its not obvious why they have broken.
Case in point, the "remote: " prefixing caused by the sideband
demultiplexer really confused me for about 15 minutes. I could
not figure out why the last test in this script was failing.
Until I pulled my head out of the sand and looked at the "actual"
file and saw those prefixes. At which point it was very obvious.
:)
We haven't touched that script in almost a year. I poked at it only
to fix a stupid error from my printf implementation, and because of
the new "remote:" prefix. Which since it is a change in behavior may
cause problems for anyone who is trying to screen-scrape the stderr
of git-push. Gawd I hope nobody's scripts are that convoluted.
--
Shawn.