git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] merge-one-file: fix "expr: non-numeric argument"
@ 2011-10-06 18:25 Jay Soffian
  2011-10-06 20:25 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Jay Soffian @ 2011-10-06 18:25 UTC (permalink / raw)
  To: git; +Cc: Jay Soffian, Junio C Hamano

When invoking expr to compare two numbers, don't quote the
variables which are the output of 'wc -c'. On OS X, this output
includes spaces, which expr balks at:

  $ sz0=`wc -c </etc/passwd`
  $ sz1=`wc -c </etc/passwd`
  $ echo "'$sz0'"
  '    3667'

  $ expr "$sz0" \< "$sz1" \* 2
  expr: non-numeric argument

  $ expr $sz0 \< $sz1 \* 2
  1

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
Noticed this while working on the CHERRY_PICK_HEAD issue.

 git-merge-one-file.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index 7aeb96952f..f612cb847a 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -117,7 +117,7 @@ case "${1:-.}${2:-.}${3:-.}" in
 
 		# If we do not have enough common material, it is not
 		# worth trying two-file merge using common subsections.
-		expr "$sz0" \< "$sz1" \* 2 >/dev/null || : >$orig
+		expr $sz0 \< $sz1 \* 2 >/dev/null || : >$orig
 		;;
 	*)
 		echo "Auto-merging $4"
-- 
1.7.7.144.gbfcf9.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] merge-one-file: fix "expr: non-numeric argument"
  2011-10-06 18:25 [PATCH] merge-one-file: fix "expr: non-numeric argument" Jay Soffian
@ 2011-10-06 20:25 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2011-10-06 20:25 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-06 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-06 18:25 [PATCH] merge-one-file: fix "expr: non-numeric argument" Jay Soffian
2011-10-06 20:25 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).