threads / patch / 1392

patchDo not rely on a sane wc

Subject: [PATCH] Do not rely on a sane wc

## tl;dr

One message between Aug 1, 2005 and Aug 1, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Aug 1, 2005, 14:32 UTC · lore

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
Show changes to git-format-patch-script +1 −1
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

← back to recent threads