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

Re: [PATCH 2/3] Add a test for git-rerere

From
Junio C Hamano <junkio@cox.net>
Date
Dec 21, 2006, 08:41 UTC
Message-ID
<7vhcvpej3i.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0612210927150.19693@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 8 quoted lines
>> > +rm $rr/postimage
>> > +echo -ne "$sha1\ta1\0" > .git/rr-cache/MERGE_RR
>> 
>> Hmmmmmm.  I've stayed away from "echo -e" so far...
>
> Rather do it with tr? Like this:
>
> 	echo -n "$sha1	a1X" | tr X '\0' > .git/rr-cache/MERGE_RR
Bog-standard old timer's way is not to use -n nor X but just do:
	echo "stuff you want to NUL terminate" | tr '\012' '\0'
> Is $((1+2)) portable enough? I always thought this is a bashism...

That's also in ksh and dash (and in POSIX) and recent updates to out *.sh scripts make liberal use of them. As long as you do not overflow you are fine.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 4 of 5 in “Add a test for git-rerere”
  1. 2/3 Add a test for git-rerereJohannes Schindelin, Dec 20, 2006
  2. Junio C HamanoDec 20, 2006
  3. Johannes SchindelinDec 21, 2006
  4. Junio C HamanoDec 21, 2006
  5. Add a test for git-rerereJohannes Schindelin, Dec 21, 2006

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.