Commit d30db560 authored by Jay Soffian's avatar Jay Soffian Committed by Junio C Hamano

merge-one-file: fix "expr: non-numeric argument"

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: default avatarJay Soffian <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent e923eaeb
......@@ -112,7 +112,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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment