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

[PATCH 2/4] merge-one-file: use 'wc' more portably

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 24, 2007, 01:13 UTC
Message-ID
<Pine.LNX.4.63.0701240213330.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Some wc prefix the number by a tab. Be prepared for this.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 git-merge-one-file.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index 7d62d79..bc7c5ef 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -87,9 +87,9 @@ case "${1:-.}${2:-.}${3:-.}" in
 		# This extracts OUR file in $orig, and uses git-apply to
 		# remove lines that are unique to ours.
 		orig=`git-unpack-file $2`
-		sz0=`wc -c <"$orig"`
+		sz0=`wc -c <"$orig" | tr -dc 0-9`
 		diff -u -La/$orig -Lb/$orig $orig $src2 | git-apply --no-add 
-		sz1=`wc -c <"$orig"`
+		sz1=`wc -c <"$orig" | tr -dc 0-9`
 
 		# If we do not have enough common material, it is not
 		# worth trying two-file merge using common subsections.
-- 
1.5.0.rc2.gc5868-dirty
Next: Junio C Hamano
Message 1 of 3 in “merge-one-file: use 'wc' more portably”
  1. 2/4 merge-one-file: use 'wc' more portablyJohannes Schindelin, Jan 24, 2007
  2. Junio C HamanoJan 25, 2007
  3. Johannes SchindelinJan 25, 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.