diff options
author | Jay Soffian <jaysoffian@gmail.com> | 2011-10-06 22:25:55 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-07 00:24:59 +0400 |
commit | d30db5605b03a45b2848fa9131c3485dc93f7dad (patch) | |
tree | ea1d54aaab59c2617037033dc36fcf1e82ae1734 | |
parent | e923eaeb901ff056421b9007adcbbce271caa7b6 (diff) |
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: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | 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 d067894bf4..ae97e1dfa6 100755 --- a/git-merge-one-file.sh +++ b/git-merge-one-file.sh @@ -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" |