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

Re: [PATCH] Add test case for ls-files --with-head

From
David Kastrup <dak@gnu.org>
Date
Oct 3, 2007, 15:52 UTC
Message-ID
<85odfgry9b.fsf@lola.goethe.zz>
In-Reply-To
<Pine.LNX.4.64.0710031634300.28395@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 23 quoted lines
> On Wed, 3 Oct 2007, Johannes Sixt wrote:
>> 
>> seq is not universally available. Can we have that as
>> 
>> for i in 0 1 2 3 4; do
>> 	for j in 0 1 2 3 4 5 6 7 8 9; do
>> 		> sub/file-$i$j
>> 		echo file-$i$j >> expected
>> 	done
>> done
>
> Or as
>
> 	i=1
> 	while test $i -le 50
> 	do
> 		num=$(printf %04d $i)
> 		> sub/file-$num
> 		echo file-$num >> expected
> 		i=$(($i+1))
> 	done
>
> This version should be as portable,

Huh? It uses the conceivably-not-builtin "test" (something which _you_ picked as something to complain about in a patch of mine where it was not used in an inner loop) on every iteration, it uses printf and it uses $((...)) arithmetic expansion. Whereas the proposal by Johannes works fine even on prehistoric shell versions. So the "as portable" enough moniker is surely weird.

> with the benefit that it is easier to change for different start and
> end values.
Correct.  But why would we want those here?
-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Johannes SchindelinNext: Carl Worth
Message 6 of 14 in “Must not modify the_index.cache as it may be passed to realloc at some point.”
  1. Must not modify the_index.cache as it may be passed to realloc at some point.Keith Packard, Oct 3, 2007
  2. Junio C HamanoOct 3, 2007
  3. Add test case for ls-files --with-headCarl Worth, Oct 3, 2007
  4. Johannes SixtOct 3, 2007
  5. Johannes SchindelinOct 3, 2007
  6. David KastrupOct 3, 2007
  7. Carl WorthOct 3, 2007
  8. David KastrupOct 3, 2007
  9. Jeff KingOct 3, 2007
  10. Johannes SchindelinOct 3, 2007
  11. Junio C HamanoOct 3, 2007
  12. Jeff KingOct 3, 2007
  13. Junio C HamanoOct 3, 2007
  14. Add test case for ls-files --with-headCarl Worth, Oct 3, 2007

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.