* [PATCH 2/4] merge-one-file: use 'wc' more portably
@ 2007-01-24 1:13 Johannes Schindelin
2007-01-25 0:09 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2007-01-24 1:13 UTC (permalink / raw)
To: git, junkio
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.
--
1.5.0.rc2.gc5868-dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] merge-one-file: use 'wc' more portably
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
2007-01-25 8:35 ` Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-01-25 0:09 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, junkio
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] merge-one-file: use 'wc' more portably
2007-01-25 0:09 ` Junio C Hamano
@ 2007-01-25 8:35 ` Johannes Schindelin
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2007-01-25 8:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Wed, 24 Jan 2007, Junio C Hamano wrote:
> 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.
I only needed a quick fix to make it work on my machine. The fact that it
was broken for so long, unnoticed by me, shows that this code path was
rarely -- if at all -- used.
But since I want it builtin, I don't want to spend time on the script...
Ciao,
Dscho
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-25 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-01-25 8:35 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox