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

[PATCH] Do not rely on a sane wc

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 1, 2005, 14:32 UTC
Message-ID
<Pine.LNX.4.58.20050801163156.12985@wgmdd8.biozentrum.uni-wuerzburg.de>

Some implementations of wc pad the line number with white space, which expr does not grok as a number.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 git-format-patch-script |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
da0488e94f7f949cbfce7422980eb2fe38166b9a
diff --git a/git-format-patch-script b/git-format-patch-script
--- a/git-format-patch-script
+++ b/git-format-patch-script
@@ -109,7 +109,7 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x4
 stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'

 git-rev-list --merge-order "$junio" "^$linus" >$series
-total=`wc -l <$series`
+total=`wc -l <$series | tr -dc "[0-9]"`
 i=$total
 while read commit
 do
Message 1 of 1 in “Do not rely on a sane wc”
  1. Do not rely on a sane wcJohannes Schindelin, Aug 1, 2005

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.