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

Re: [PATCH 2/6] git-p4: handle utf16 filetype properly

From
PWPete Wyckoff <pw@padd.com>
Date
Oct 16, 2011, 14:38 UTC
Message-ID
<20111016143844.GB22144@arf.padd.com>
In-Reply-To
<201110161152.32335.stefano.lattarini@gmail.com>
stefano.lattarini@gmail.com wrote on Sun, 16 Oct 2011 11:52 +0200:
Show 47 quoted lines
> Hello Pete.
> 
> One more "outsider nit" here ...
> 
> On Saturday 15 October 2011, Pete Wyckoff wrote:
> >
> > [SNIP]
> > 
> > Add a test case to check utf16 handling, and +k and +ko handling.
> >
> > [SNIP]
> >
> > diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
> > new file mode 100755
> > index 0000000..cf07e6d
> > --- /dev/null
> > +++ b/t/t9802-git-p4-filetype.sh
> > @@ -0,0 +1,108 @@
> > +#!/bin/sh
> > +
> > +test_description='git-p4 p4 filetype tests'
> > +
> > +. ./lib-git-p4.sh
> > +
> > +test_expect_success 'start p4d' '
> > +	start_p4d
> > +'
> > +
> > +test_expect_success 'utf-16 file create' '
> > +	(
> > +		cd "$cli" &&
> > +
> > +		# p4 saves this verbatim
> > +		echo -e "three\nline\ntext" >f-ascii &&
> >
> Not portable to (at least) solaris /usr/xpg4/bin/sh and /bin/ksh:
> 
>  $ /bin/ksh -c 'echo -e "three\nline\ntext"'
>  -e three
>  line
>  text
> 
> In fact, use of options and/or escape sequences in "echo" arguments is
> highly unportable (see the entry for `echo' in the "Limitations of Shell
> Builtins" section of the autoconf manual); your best bet is to use printf,
> which is more portable and well-behaved (at least on systems that are not
> musuem pieces).

Indeed. The t/ source consistently uses printf where \n is needed.

Show 14 quoted lines
> >
> > [SNIP]
> >
> > +
> > +build_smush() {
> > +	cat >k_smush.py <<-EOF &&
> > +	import re, sys
> > +	sys.stdout.write(re.sub(r'(?i)\\\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\\\$', r'$\1$', sys.stdin.read()))
> > +	EOF
> >
> This is a basically a stylistic nit, so fell free to disregard it completely,
> but ... wouldn't it be simpler to quote the "EOF" at the here-doc beginning,
> so that you don't have to escape all the backslashes in the here-doc itself?
> Similarly for other later usages.
Switched to using \EOF and got rid of the extranneous \.
Thanks,
		-- Pete
Previous: Stefano LattariniNext: Pete Wyckoff
Message 8 of 13 in “git-p4 tests, filetypes, shell metacharacters”
  1. 0/6 git-p4 tests, filetypes, shell metacharactersPete Wyckoff, Oct 15, 2011
  2. 1/6 git-p4 tests: refactor and cleanupPete Wyckoff, Oct 15, 2011
  3. Stefano LattariniOct 16, 2011
  4. Stefano LattariniOct 16, 2011
  5. Pete WyckoffOct 16, 2011
  6. 2/6 git-p4: handle utf16 filetype properlyPete Wyckoff, Oct 15, 2011
  7. Stefano LattariniOct 16, 2011
  8. Pete WyckoffOct 16, 2011
  9. 3/6 git-p4: recognize all p4 filetypesPete Wyckoff, Oct 15, 2011
  10. 4/6 git-p4: stop ignoring apple filetypePete Wyckoff, Oct 15, 2011
  11. 5/6 git-p4: keyword flattening fixesPete Wyckoff, Oct 15, 2011
  12. 6/6 git-p4: handle files with shell metacharactersPete Wyckoff, Oct 15, 2011
  13. Luke DiamandOct 15, 2011

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.