git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/7] Use 'printf %s $x' notation in t5401
Date: Tue, 29 Jan 2008 22:40:37 -0800	[thread overview]
Message-ID: <7vlk67izoa.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080130062156.GA15838@spearce.org> (Shawn O. Pearce's message of "Wed, 30 Jan 2008 01:21:56 -0500")

"Shawn O. Pearce" <spearce@spearce.org> writes:

> 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.

That sounds like a bug to me.

> diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
> index 3eea306..9734fc5 100755
> --- a/t/t5401-update-hooks.sh
> +++ b/t/t5401-update-hooks.sh
> @@ -25,7 +25,7 @@ test_expect_success setup '
>  
>  cat >victim/.git/hooks/pre-receive <<'EOF'
>  #!/bin/sh
> -printf "$@" >>$GIT_DIR/pre-receive.args
> +printf %s "$@" >>$GIT_DIR/pre-receive.args

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:

	printf '%s\n' "$@"

Likewise for post-receive.args.

  reply	other threads:[~2008-01-30  6:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30  6:21 [PATCH 1/7] Use 'printf %s $x' notation in t5401 Shawn O. Pearce
2008-01-30  6:40 ` Junio C Hamano [this message]
2008-01-30  6:48   ` Shawn O. Pearce
2008-01-31  1:16     ` Junio C Hamano
2008-01-31  3:41       ` Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vlk67izoa.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).