git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Shourya Shukla <shouryashukla.oo@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
	christian.couder@gmail.com, kaartic.sivaraam@gmail.com,
	johannes.schindelin@gmx.de, chriscool@tuxfamily.org,
	liu.denton@gmail.com
Subject: Re: [PATCH 1/4] t7401: modernize style
Date: Thu, 6 Aug 2020 14:15:53 +0530	[thread overview]
Message-ID: <20200806084553.GA13942@konoha> (raw)
In-Reply-To: <20200805204924.GF9546@syl.lan>

On 05/08 04:49, Taylor Blau wrote:
> On Wed, Aug 05, 2020 at 03:37:55PM -0400, Denton Liu wrote:
> > Hi Shourya,
> >
> > On Wed, Aug 05, 2020 at 11:19:18PM +0530, Shourya Shukla wrote:
> > > The tests in 't7401-submodule-summary.sh' were written a long time ago
> > > and have some violations with respect to our CodingGuidelines such as
> > > incorrect spacing in usages of the redirection operator and absence
> > > of line feed between statements in case of the '|' (pipe) operator.
> >
> > I'm not aware of anywhere in CodingGuidelines that says you can't have
> > the pipe operator on a single line. I assume you're referring to the
> > part that reads
> >
> > 	If a command sequence joined with && or || or | spans multiple
> > 	lines, put each command on a separate line and put && and || and
> > 	| operators at the end of each line, rather than the start.
> >
> > Note that says "If a command sequence [...] spans multiple lines", which
> > doesn't apply in our case.
> >
> > > Update it to match the CodingGuidelines.
> > >
> > > Mentored-by: Christian Couder <chriscool@tuxfamily.org>
> > > Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
> > > Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
> > > ---
> > >  t/t7401-submodule-summary.sh | 8 +++++---
> > >  1 file changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
> > > index 9bc841d085..4439fb7c17 100755
> > > --- a/t/t7401-submodule-summary.sh
> > > +++ b/t/t7401-submodule-summary.sh
> > > @@ -16,12 +16,13 @@ add_file () {
> > >  	owd=$(pwd)
> > >  	cd "$sm"
> > >  	for name; do
> > > -		echo "$name" > "$name" &&
> > > +		echo "$name" >"$name" &&
> 
> This change is good.
> 
> > >  		git add "$name" &&
> > >  		test_tick &&
> > >  		git commit -m "Add $name"
> > >  	done >/dev/null
> > > -	git rev-parse --verify HEAD | cut -c1-7
> > > +	git rev-parse --verify HEAD |
> > > +	cut -c1-7
> >
> > For the reason above, I disagree with this change as-is. However, one
> > useful thing that you can do here is breaking the pipe up entirely. We
> > want to avoid is having a git command in the upstream of a pipe. This is
> > because the return code of a pipe comes from the last command executed
> > so if the rev-parse fails, its return code is swallowed and we have no
> > way of knowing.
> >
> > You could break the pipe up by storing the output of the rev-parse in an
> > intermediate file and then have cut read from that file.
> 
> This is a good suggestion (I was preparing to write an email to say the
> same thing, but I'm glad that I checked Denton's response before doing
> so). Something like:
> 
> 	git rev-parse --verify HEAD >out &&
> 	cut -c1-7 out
> 
> would suffice and be in good style.

Sure. I will make the amends.


  reply	other threads:[~2020-08-06  8:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 17:49 [GSoC][RESEND][PATCH 0/4] t7401: modernize, cleanup and warn Shourya Shukla
2020-08-05 17:49 ` [PATCH 1/4] t7401: modernize style Shourya Shukla
2020-08-05 19:37   ` Denton Liu
2020-08-05 20:49     ` Taylor Blau
2020-08-06  8:45       ` Shourya Shukla [this message]
2020-08-05 17:49 ` [PATCH 2/4] t7401: change test_i18ncmp syntax for clarity Shourya Shukla
2020-08-05 20:58   ` Taylor Blau
2020-08-05 21:23   ` Junio C Hamano
2020-08-05 17:49 ` [PATCH 3/4] t7401: ensure uniformity in the '--for-status' test Shourya Shukla
2020-08-05 21:01   ` Taylor Blau
2020-08-05 22:25     ` Junio C Hamano
2020-08-05 22:26       ` Taylor Blau
2020-08-05 21:30   ` Junio C Hamano
2020-08-06  8:50     ` Shourya Shukla
2020-08-06 17:18       ` Junio C Hamano
2020-08-05 17:49 ` [PATCH 4/4] t7401: add a WARNING and a NEEDSWORK Shourya Shukla
2020-08-05 21:04   ` Taylor Blau
2020-08-05 21:36   ` Junio C Hamano
2020-08-06 11:27     ` Shourya Shukla
2020-08-06 21:11       ` Junio C Hamano
2020-08-07 14:55         ` Christian Couder
2020-08-12 19:27 ` [GSoC][PATCH v2 0/4] t7401: modernize, cleanup and more Shourya Shukla
2020-08-12 19:27   ` [PATCH v2 1/4] t7401: modernize style Shourya Shukla
2020-08-13  8:06     ` Kaartic Sivaraam
2020-08-13 16:46       ` Junio C Hamano
2020-08-14 14:41         ` Shourya Shukla
2020-08-14 17:06           ` Junio C Hamano
2020-08-12 19:27   ` [PATCH v2 2/4] t7401: change test_i18ncmp syntax for clarity Shourya Shukla
2020-08-12 20:57     ` Junio C Hamano
2020-08-12 21:02       ` Junio C Hamano
2020-08-14 14:57         ` Shourya Shukla
2020-08-12 19:27   ` [PATCH v2 3/4] t7401: change indentation for enhanced readability Shourya Shukla
2020-08-12 19:27   ` [PATCH v2 4/4] t7401: add a NEEDSWORK Shourya Shukla
  -- strict thread matches above, loose matches on Subject: below --
2020-07-26 14:25 [GSoC][PATCH 0/4] t7401: modernize, cleanup and warn Shourya Shukla
2020-07-26 14:25 ` [PATCH 1/4] t7401: modernize style Shourya Shukla

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20200806084553.GA13942@konoha \
    --to=shouryashukla.oo@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=liu.denton@gmail.com \
    --cc=me@ttaylorr.com \
    --subject='Re: [PATCH 1/4] t7401: modernize style' \
    /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

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).