git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
To: Shourya Shukla <shouryashukla.oo@gmail.com>
Cc: christian.couder@gmail.com, git@vger.kernel.org,
	gitster@pobox.com, Johannes.Schindelin@gmx.de,
	liu.denton@gmail.com, Christian Couder <chriscool@tuxfamily.org>,
	Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v2 1/4] t7401: modernize style
Date: Thu, 13 Aug 2020 13:36:49 +0530	[thread overview]
Message-ID: <c70f7bb5d1289f5318da7b99e41cf5828a451174.camel@gmail.com> (raw)
In-Reply-To: <20200812192737.13971-2-shouryashukla.oo@gmail.com>

On Thu, 2020-08-13 at 00:57 +0530, Shourya Shukla wrote:
>
> [...]
>
> Using a Git command in the upstream of a pipe might result in us
> losing its exit code. So, convert such usages so that they write to
> a file and read from them.
> 

While that is a good enough reason to avoid using pipes in places where
we look for the exit code of a command like within test_expect_success,
I'm not sure if that reason holds for the places that the patch
changes.

> [...]
>
> diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-
> summary.sh
> index 9bc841d085..8ee78bcb69 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" &&
>  		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 >out &&
> +	cut -c1-7 out

In any case, I believe we can avoid the 'cut' altogether in both places
by doing something like this instead:

   git rev-parse --short=7 HEAD

My quick check shows the test script is happy with this change.

>  	cd "$owd"
>  }
>  commit_file () {
> @@ -125,7 +126,8 @@ commit_file sm1 &&
>  head3=$(
>  	cd sm1 &&
>  	git reset --hard HEAD~2 >/dev/null &&
> -	git rev-parse --verify HEAD | cut -c1-7
> +	git rev-parse --verify HEAD >out &&
> +	cut -c1-7 out
>  )
>  
>  test_expect_success 'modified submodule(backward)' "

-- 
Sivaraam



  reply	other threads:[~2020-08-13  8:07 UTC|newest]

Thread overview: 33+ 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
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 [this message]
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

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=c70f7bb5d1289f5318da7b99e41cf5828a451174.camel@gmail.com \
    --to=kaartic.sivaraam@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=liu.denton@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=shouryashukla.oo@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).