git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/7] Use 'printf %s $x' notation in t5401

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 30, 2008, 06:48 UTC
Message-ID
<20080130064845.GR24004@spearce.org>
In-Reply-To
<7vlk67izoa.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> > 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:

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.

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

-- 
Shawn.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “Use 'printf %s $x' notation in t5401”
  1. 1/7 Use 'printf %s $x' notation in t5401Shawn O. Pearce, Jan 30, 2008
  2. Junio C HamanoJan 30, 2008
  3. Shawn O. PearceJan 30, 2008
  4. Junio C HamanoJan 31, 2008
  5. Shawn O. PearceJan 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.