git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] t7401: modernize style

From
Shourya Shukla <shouryashukla.oo@gmail.com>
Date
Aug 6, 2020, 08:45 UTC
Message-ID
<20200806084553.GA13942@konoha>
In-Reply-To
<20200805204924.GF9546@syl.lan>
On 05/08 04:49, Taylor Blau wrote:
Show 68 quoted lines
> 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.
Previous: Taylor BlauNext: Shourya Shukla
Message 21 of 33 in “t7401: modernize, cleanup and warn”
  1. Shourya ShuklaAug 5, 2020
  2. 3/4 t7401: ensure uniformity in the '--for-status' testShourya Shukla, Aug 5, 2020
  3. Taylor BlauAug 5, 2020
  4. Junio C HamanoAug 5, 2020
  5. Taylor BlauAug 5, 2020
  6. Junio C HamanoAug 5, 2020
  7. Shourya ShuklaAug 6, 2020
  8. Junio C HamanoAug 6, 2020
  9. 4/4 t7401: add a WARNING and a NEEDSWORKShourya Shukla, Aug 5, 2020
  10. Taylor BlauAug 5, 2020
  11. Junio C HamanoAug 5, 2020
  12. Shourya ShuklaAug 6, 2020
  13. Junio C HamanoAug 6, 2020
  14. Christian CouderAug 7, 2020
  15. 2/4 t7401: change test_i18ncmp syntax for clarityShourya Shukla, Aug 5, 2020
  16. Taylor BlauAug 5, 2020
  17. Junio C HamanoAug 5, 2020
  18. 1/4 t7401: modernize styleShourya Shukla, Aug 5, 2020
  19. Denton LiuAug 5, 2020
  20. Taylor BlauAug 5, 2020
  21. Shourya ShuklaAug 6, 2020
  22. [GSoC][PATCH v2 0/4] t7401: modernize, cleanup and moreShourya Shukla, Aug 12, 2020
  23. 1/4 t7401: modernize styleShourya Shukla, Aug 12, 2020
  24. Kaartic SivaraamAug 13, 2020
  25. Junio C HamanoAug 13, 2020
  26. Shourya ShuklaAug 14, 2020
  27. Junio C HamanoAug 14, 2020
  28. 2/4 t7401: change test_i18ncmp syntax for clarityShourya Shukla, Aug 12, 2020
  29. Junio C HamanoAug 12, 2020
  30. Junio C HamanoAug 12, 2020
  31. Shourya ShuklaAug 14, 2020
  32. 3/4 t7401: change indentation for enhanced readabilityShourya Shukla, Aug 12, 2020
  33. 4/4 t7401: add a NEEDSWORKShourya Shukla, Aug 12, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.