Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, junkio@cox.net
Subject: Re: [PATCH 2/4] merge-one-file: use 'wc' more portably
Date: Wed, 24 Jan 2007 16:09:07 -0800	[thread overview]
Message-ID: <7v3b60dl24.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0701240213330.22628@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Wed, 24 Jan 2007 02:13:55 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> 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.

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.

  reply	other threads:[~2007-01-25  0:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24  1:13 [PATCH 2/4] merge-one-file: use 'wc' more portably Johannes Schindelin
2007-01-25  0:09 ` Junio C Hamano [this message]
2007-01-25  8:35   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v3b60dl24.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox