git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.
       [not found] <Re: [PATCH v8 7/9] blame: add a fingerprint heuristic to match ignored lines>
@ 2019-06-15 18:40 ` michael
  2019-06-16 19:02   ` Denton Liu
  0 siblings, 1 reply; 4+ messages in thread
From: michael @ 2019-06-15 18:40 UTC (permalink / raw)
  To: git
  Cc: Jeff King, Stefan Beller, Jeff Smith, Junio C Hamano,
	René Scharfe, Ævar Arnfjörð Bjarmason,
	David Kastrup, Johannes Schindelin, Barret Rhoden,
	SZEDER Gábor, Michael Platings

From: Michael Platings <michael@platin.gs>

---
 t/t8014-blame-ignore-fuzzy.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/t/t8014-blame-ignore-fuzzy.sh b/t/t8014-blame-ignore-fuzzy.sh
index 1ff59624e9..13f3313710 100755
--- a/t/t8014-blame-ignore-fuzzy.sh
+++ b/t/t8014-blame-ignore-fuzzy.sh
@@ -332,7 +332,9 @@ test_expect_success setup '
 for i in $(test_seq 2 $last_test); do
 	eval title="\$title$i"
 	test_expect_success "$title" \
-	"git blame -M9 --ignore-rev $IGNOREME $i | sed -e \"$pick_author\" >actual && test_cmp expected$i actual"
+	"git blame -M9 --ignore-rev $IGNOREME $i >output &&
+	sed -e \"$pick_author\" <output >actual &&
+	test_cmp expected$i actual"
 done
 
 # This invoked a null pointer dereference when the chunk callback was called
@@ -357,7 +359,8 @@ test_expect_success 'Diff chunks with no suspects' '
 
 	test_write_lines 1 1 >expected &&
 
-	git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file | sed -e "$pick_author" >actual &&
+	git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file >output &&
+	sed -e "$pick_author" <output >actual &&
 
 	test_cmp expected actual
 	'
@@ -387,7 +390,8 @@ test_expect_success 'position matching' '
 
 	test_write_lines 1 1 2 2 >expected &&
 
-	git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 | sed -e "$pick_author" >actual &&
+	git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 >output &&
+	sed -e "$pick_author" <output >actual &&
 
 	test_cmp expected actual
 	'
@@ -424,7 +428,8 @@ test_expect_success 'preserve order' '
 
 	test_write_lines 1 2 3 >expected &&
 
-	git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 | sed -e "$pick_author" >actual &&
+	git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 >output &&
+	sed -e "$pick_author" <output >actual &&
 
 	test_cmp expected actual
 	'
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.
  2019-06-15 18:40 ` [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden michael
@ 2019-06-16 19:02   ` Denton Liu
  2019-06-16 20:35     ` Michael Platings
  2019-06-16 22:41     ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Denton Liu @ 2019-06-16 19:02 UTC (permalink / raw)
  To: michael
  Cc: git, Jeff King, Stefan Beller, Jeff Smith, Junio C Hamano,
	René Scharfe, Ævar Arnfjörð Bjarmason,
	David Kastrup, Johannes Schindelin, Barret Rhoden,
	SZEDER Gábor

Thanks for the patch, Michael!

On Sat, Jun 15, 2019 at 07:40:39PM +0100, michael@platin.gs wrote:
> Subject: [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.

For your commit message, the usual convention is to first specify the
area you're working on followed by a colon and a brief summary.
Typically, the subject starts with a lowercase character and also
doesn't end with any punctuation. See [[describe-changes]] under
Documentation/SubmittingPatches for more details.

For yours, I would reword your commit message to something like

	t8014: avoid git command in upstream pipe
	
	Use an intermediate file between between git blame and sed to avoid
	git blame's exit code being hidden.

In addition, your commit message is missing a sign-off line. You can add
one by passing `-s` to git commit but you should read about what it
means in [[sign-off]] in SubmittingPatches.

> From: Michael Platings <michael@platin.gs>
> 
> ---
>  t/t8014-blame-ignore-fuzzy.sh | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/t/t8014-blame-ignore-fuzzy.sh b/t/t8014-blame-ignore-fuzzy.sh
> index 1ff59624e9..13f3313710 100755
> --- a/t/t8014-blame-ignore-fuzzy.sh
> +++ b/t/t8014-blame-ignore-fuzzy.sh
> @@ -332,7 +332,9 @@ test_expect_success setup '
>  for i in $(test_seq 2 $last_test); do
>  	eval title="\$title$i"
>  	test_expect_success "$title" \
> -	"git blame -M9 --ignore-rev $IGNOREME $i | sed -e \"$pick_author\" >actual && test_cmp expected$i actual"
> +	"git blame -M9 --ignore-rev $IGNOREME $i >output &&
> +	sed -e \"$pick_author\" <output >actual &&

We should take advantage of the fact that sed can open its own input
here. So we should drop the `<` and just pass the filename to sed. Same
applies to the below.

Thanks,

Denton

> +	test_cmp expected$i actual"
>  done
>  
>  # This invoked a null pointer dereference when the chunk callback was called
> @@ -357,7 +359,8 @@ test_expect_success 'Diff chunks with no suspects' '
>  
>  	test_write_lines 1 1 >expected &&
>  
> -	git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file | sed -e "$pick_author" >actual &&
> +	git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file >output &&
> +	sed -e "$pick_author" <output >actual &&
>  
>  	test_cmp expected actual
>  	'
> @@ -387,7 +390,8 @@ test_expect_success 'position matching' '
>  
>  	test_write_lines 1 1 2 2 >expected &&
>  
> -	git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 | sed -e "$pick_author" >actual &&
> +	git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 >output &&
> +	sed -e "$pick_author" <output >actual &&
>  
>  	test_cmp expected actual
>  	'
> @@ -424,7 +428,8 @@ test_expect_success 'preserve order' '
>  
>  	test_write_lines 1 2 3 >expected &&
>  
> -	git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 | sed -e "$pick_author" >actual &&
> +	git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 >output &&
> +	sed -e "$pick_author" <output >actual &&
>  
>  	test_cmp expected actual
>  	'
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.
  2019-06-16 19:02   ` Denton Liu
@ 2019-06-16 20:35     ` Michael Platings
  2019-06-16 22:41     ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Platings @ 2019-06-16 20:35 UTC (permalink / raw)
  To: Denton Liu
  Cc: Git mailing list, Jeff King, Stefan Beller, Jeff Smith,
	Junio C Hamano, René Scharfe,
	Ævar Arnfjörð Bjarmason, David Kastrup,
	Johannes Schindelin, Barret Rhoden, SZEDER Gábor

Hi Denton,
Thanks for the review. The patch was supposed to be in response to
https://public-inbox.org/git/20190613151756.GA31952@szeder.dev/ but
apparently I didn't use --in-reply-to correctly. I'll resubmit with
the requested changes.
-Michael

On Sun, 16 Jun 2019 at 20:02, Denton Liu <liu.denton@gmail.com> wrote:
>
> Thanks for the patch, Michael!
>
> On Sat, Jun 15, 2019 at 07:40:39PM +0100, michael@platin.gs wrote:
> > Subject: [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.
>
> For your commit message, the usual convention is to first specify the
> area you're working on followed by a colon and a brief summary.
> Typically, the subject starts with a lowercase character and also
> doesn't end with any punctuation. See [[describe-changes]] under
> Documentation/SubmittingPatches for more details.
>
> For yours, I would reword your commit message to something like
>
>         t8014: avoid git command in upstream pipe
>
>         Use an intermediate file between between git blame and sed to avoid
>         git blame's exit code being hidden.
>
> In addition, your commit message is missing a sign-off line. You can add
> one by passing `-s` to git commit but you should read about what it
> means in [[sign-off]] in SubmittingPatches.
>
> > From: Michael Platings <michael@platin.gs>
> >
> > ---
> >  t/t8014-blame-ignore-fuzzy.sh | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/t/t8014-blame-ignore-fuzzy.sh b/t/t8014-blame-ignore-fuzzy.sh
> > index 1ff59624e9..13f3313710 100755
> > --- a/t/t8014-blame-ignore-fuzzy.sh
> > +++ b/t/t8014-blame-ignore-fuzzy.sh
> > @@ -332,7 +332,9 @@ test_expect_success setup '
> >  for i in $(test_seq 2 $last_test); do
> >       eval title="\$title$i"
> >       test_expect_success "$title" \
> > -     "git blame -M9 --ignore-rev $IGNOREME $i | sed -e \"$pick_author\" >actual && test_cmp expected$i actual"
> > +     "git blame -M9 --ignore-rev $IGNOREME $i >output &&
> > +     sed -e \"$pick_author\" <output >actual &&
>
> We should take advantage of the fact that sed can open its own input
> here. So we should drop the `<` and just pass the filename to sed. Same
> applies to the below.
>
> Thanks,
>
> Denton
>
> > +     test_cmp expected$i actual"
> >  done
> >
> >  # This invoked a null pointer dereference when the chunk callback was called
> > @@ -357,7 +359,8 @@ test_expect_success 'Diff chunks with no suspects' '
> >
> >       test_write_lines 1 1 >expected &&
> >
> > -     git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file | sed -e "$pick_author" >actual &&
> > +     git blame --ignore-rev $REV_2 --ignore-rev $REV_3 file >output &&
> > +     sed -e "$pick_author" <output >actual &&
> >
> >       test_cmp expected actual
> >       '
> > @@ -387,7 +390,8 @@ test_expect_success 'position matching' '
> >
> >       test_write_lines 1 1 2 2 >expected &&
> >
> > -     git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 | sed -e "$pick_author" >actual &&
> > +     git blame --ignore-rev $REV_3 --ignore-rev $REV_4 file2 >output &&
> > +     sed -e "$pick_author" <output >actual &&
> >
> >       test_cmp expected actual
> >       '
> > @@ -424,7 +428,8 @@ test_expect_success 'preserve order' '
> >
> >       test_write_lines 1 2 3 >expected &&
> >
> > -     git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 | sed -e "$pick_author" >actual &&
> > +     git blame --ignore-rev $REV_4 --ignore-rev $REV_5 file3 >output &&
> > +     sed -e "$pick_author" <output >actual &&
> >
> >       test_cmp expected actual
> >       '
> > --
> > 2.21.0
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden.
  2019-06-16 19:02   ` Denton Liu
  2019-06-16 20:35     ` Michael Platings
@ 2019-06-16 22:41     ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2019-06-16 22:41 UTC (permalink / raw)
  To: Denton Liu
  Cc: michael, git, Jeff King, Stefan Beller, Jeff Smith,
	René Scharfe, Ævar Arnfjörð Bjarmason,
	David Kastrup, Johannes Schindelin, Barret Rhoden,
	SZEDER Gábor

Denton Liu <liu.denton@gmail.com> writes:

> For yours, I would reword your commit message to something like
>
> 	t8014: avoid git command in upstream pipe
> 	
> 	Use an intermediate file between between git blame and sed to avoid
> 	git blame's exit code being hidden.

I agree that the main "points" of this patch that should be
highlighted on the title line are that it is about a test, and it is
about not hiding a failure of a Git command by placing it on the
upstream side of a pipe---the above title is very nicely written.

>> +	"git blame -M9 --ignore-rev $IGNOREME $i >output &&
>> +	sed -e \"$pick_author\" <output >actual &&
>
> We should take advantage of the fact that sed can open its own input
> here. So we should drop the `<` and just pass the filename to sed. Same
> applies to the below.

While I do not think it matters too much in this case, I agree it is
a good habit to get into, because it would give the command a chance
to produce a better error diagnosis (i.e. "malformed input on line
X" vs "malformed input on line X in file F"), when it wants to
report an error in input, if we give the name of the file to open to
the command instead of an already-open file descriptor, for one thing.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-16 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Re: [PATCH v8 7/9] blame: add a fingerprint heuristic to match ignored lines>
2019-06-15 18:40 ` [PATCH] Use an intermediate file between between git blame and sed to avoid git blame's exit code being hidden michael
2019-06-16 19:02   ` Denton Liu
2019-06-16 20:35     ` Michael Platings
2019-06-16 22:41     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).