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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> Some wc prefix the number by a tab. Be prepared for this.
>
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
> ---
>  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.

I would prefer losing dq around the $sz0 and $sz1 where they are
used, instead of spawning tr here, and also tighten error
checking by stringing these command sequence with && followed by
a || exit.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]