{"thread":{"id":"6492","subject":"[PATCH 2/4] merge-one-file: use 'wc' more portably","startedAt":"2007-01-24T01:13:55Z","lastAt":"2007-01-25T08:35:50Z","messageCount":3,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"32467","messageId":"Pine.LNX.4.63.0701240213330.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6492","inReplyTo":null,"subject":"[PATCH 2/4] merge-one-file: use 'wc' more portably","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-24T01:13:55Z","receivedAt":"2007-01-24T01:13:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSome wc prefix the number by a tab. Be prepared for this.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n git-merge-one-file.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-merge-one-file.sh b/git-merge-one-file.sh\nindex 7d62d79..bc7c5ef 100755\n--- a/git-merge-one-file.sh\n+++ b/git-merge-one-file.sh\n@@ -87,9 +87,9 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n \t\t# This extracts OUR file in $orig, and uses git-apply to\n \t\t# remove lines that are unique to ours.\n \t\torig=`git-unpack-file $2`\n-\t\tsz0=`wc -c <\"$orig\"`\n+\t\tsz0=`wc -c <\"$orig\" | tr -dc 0-9`\n \t\tdiff -u -La/$orig -Lb/$orig $orig $src2 | git-apply --no-add \n-\t\tsz1=`wc -c <\"$orig\"`\n+\t\tsz1=`wc -c <\"$orig\" | tr -dc 0-9`\n \n \t\t# If we do not have enough common material, it is not\n \t\t# worth trying two-file merge using common subsections.\n-- \n1.5.0.rc2.gc5868-dirty\n"},{"id":"32575","messageId":"7v3b60dl24.fsf@assigned-by-dhcp.cox.net","threadId":"6492","inReplyTo":"Pine.LNX.4.63.0701240213330.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 2/4] merge-one-file: use 'wc' more portably","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-25T00:09:07Z","receivedAt":"2007-01-25T00:09:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Some wc prefix the number by a tab. Be prepared for this.\n>\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> ---\n>  git-merge-one-file.sh |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh\n> index 7d62d79..bc7c5ef 100755\n> --- a/git-merge-one-file.sh\n> +++ b/git-merge-one-file.sh\n> @@ -87,9 +87,9 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n>  \t\t# This extracts OUR file in $orig, and uses git-apply to\n>  \t\t# remove lines that are unique to ours.\n>  \t\torig=`git-unpack-file $2`\n> -\t\tsz0=`wc -c <\"$orig\"`\n> +\t\tsz0=`wc -c <\"$orig\" | tr -dc 0-9`\n>  \t\tdiff -u -La/$orig -Lb/$orig $orig $src2 | git-apply --no-add \n> -\t\tsz1=`wc -c <\"$orig\"`\n> +\t\tsz1=`wc -c <\"$orig\" | tr -dc 0-9`\n>  \n>  \t\t# If we do not have enough common material, it is not\n>  \t\t# worth trying two-file merge using common subsections.\n\nI would prefer losing dq around the $sz0 and $sz1 where they are\nused, instead of spawning tr here, and also tighten error\nchecking by stringing these command sequence with && followed by\na || exit.\n"},{"id":"32594","messageId":"Pine.LNX.4.63.0701250934380.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6492","inReplyTo":"7v3b60dl24.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/4] merge-one-file: use 'wc' more portably","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-25T08:35:50Z","receivedAt":"2007-01-25T08:35:50Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 24 Jan 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Some wc prefix the number by a tab. Be prepared for this.\n> >\n> > Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> > ---\n> >  git-merge-one-file.sh |    4 ++--\n> >  1 files changed, 2 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh\n> > index 7d62d79..bc7c5ef 100755\n> > --- a/git-merge-one-file.sh\n> > +++ b/git-merge-one-file.sh\n> > @@ -87,9 +87,9 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n> >  \t\t# This extracts OUR file in $orig, and uses git-apply to\n> >  \t\t# remove lines that are unique to ours.\n> >  \t\torig=`git-unpack-file $2`\n> > -\t\tsz0=`wc -c <\"$orig\"`\n> > +\t\tsz0=`wc -c <\"$orig\" | tr -dc 0-9`\n> >  \t\tdiff -u -La/$orig -Lb/$orig $orig $src2 | git-apply --no-add \n> > -\t\tsz1=`wc -c <\"$orig\"`\n> > +\t\tsz1=`wc -c <\"$orig\" | tr -dc 0-9`\n> >  \n> >  \t\t# If we do not have enough common material, it is not\n> >  \t\t# worth trying two-file merge using common subsections.\n> \n> I would prefer losing dq around the $sz0 and $sz1 where they are\n> used, instead of spawning tr here, and also tighten error\n> checking by stringing these command sequence with && followed by\n> a || exit.\n\nI only needed a quick fix to make it work on my machine. The fact that it \nwas broken for so long, unnoticed by me, shows that this code path was \nrarely -- if at all -- used.\n\nBut since I want it builtin, I don't want to spend time on the script...\n\nCiao,\nDscho\n"}]}