@matheusbsbs / matheus-bagliano / commits / 733f1815ab
Fork 0

Use 'printf %s $x' notation in t5401

We only care about getting what should be an empty string and sending it to a file, without a trailing LF, so the empty string translates into a 0 byte file. Earlier when I originally wrote these lines Mac OS X allowed the format string of printf to be the empty string, but more recent versions appear to have been 'improved' with error messages if the format is not given. This may cause problems if we ever wind up with changes to the hook tests. A minor cleanup makes the test more safe on all systems, by conforming to accepted printf conventions. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Jan 30, 2008 at 01:21 UTC 733f1815abf99fe43eb8a9d6df5e0466751e6ba3
1 file changed +4 -4
t/t5401-update-hooks.sh
+4 -4
@@ -25,7 +25,7 @@ test_expect_success setup '
25
26 cat >victim/.git/hooks/pre-receive <<'EOF'
27 #!/bin/sh
28 -printf "$@" >>$GIT_DIR/pre-receive.args
28 +printf %s "$@" >>$GIT_DIR/pre-receive.args
29 cat - >$GIT_DIR/pre-receive.stdin
30 echo STDOUT pre-receive
31 echo STDERR pre-receive >&2
@@ -35,7 +35,7 @@ chmod u+x victim/.git/hooks/pre-receive
35 cat >victim/.git/hooks/update <<'EOF'
36 #!/bin/sh
37 echo "$@" >>$GIT_DIR/update.args
38 -read x; printf "$x" >$GIT_DIR/update.stdin
38 +read x; printf %s "$x" >$GIT_DIR/update.stdin
39 echo STDOUT update $1
40 echo STDERR update $1 >&2
41 test "$1" = refs/heads/master || exit
@@ -44,7 +44,7 @@ chmod u+x victim/.git/hooks/update
44
45 cat >victim/.git/hooks/post-receive <<'EOF'
46 #!/bin/sh
47 -printf "$@" >>$GIT_DIR/post-receive.args
47 +printf %s "$@" >>$GIT_DIR/post-receive.args
48 cat - >$GIT_DIR/post-receive.stdin
49 echo STDOUT post-receive
50 echo STDERR post-receive >&2
@@ -54,7 +54,7 @@ chmod u+x victim/.git/hooks/post-receive
54 cat >victim/.git/hooks/post-update <<'EOF'
55 #!/bin/sh
56 echo "$@" >>$GIT_DIR/post-update.args
57 -read x; printf "$x" >$GIT_DIR/post-update.stdin
57 +read x; printf %s "$x" >$GIT_DIR/post-update.stdin
58 echo STDOUT post-update
59 echo STDERR post-update >&2
60 EOF