git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2 01/14] t/t5505-remote: modernize style
Date: Sun, 23 Jun 2013 00:42:06 -0700	[thread overview]
Message-ID: <7vehbtgto1.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1371887901-5659-2-git-send-email-artagnon@gmail.com

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> Modernize the style of all tests throughout the file:
> - Remove spurious blank lines.
> - Indent the test body.
> - Make sure that all lines end with &&, to make it easier to spot breaks
>   in the chain.
> - When executing something in a subshell, put the parenthesis on
>   separate lines and indent the body.  Also make sure that the first
>   statement in the subshell is a 'cd'.
> - When redirecting output, replace the > output forms with >output.
> - Use the <<-\EOF and <<-EOF forms of heredoc, not <<EOF.  Also, don't
>   de-indent the heredoc body.
> - When creating an empty file, use : >output form over >output for
>   clarity.

Everything except the last one is good, I think.

For the last one, I prefer ">output" moderately over ": >output", as
both are equally clear to people who write shell scripts, but this
preference is not strong enough to make me change ": >output" that
is originally in the file to ">output" in a patch.  In the very old
days, there were some implementations of shells that mishandled
">output" but those days are long gone.

> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  t/t5505-remote.sh | 813 +++++++++++++++++++++++++++++-------------------------
>  1 file changed, 440 insertions(+), 373 deletions(-)
>
> -cat > test/expect << EOF
> ...
> +cat >test/expect <<-EOF
>  * remote origin
>    Fetch URL: $(pwd)/one
>    Push  URL: $(pwd)/one

This one is questionable; if it is not indented with HT, there is no
point using the -EOF form.

> -cat > test/expect << EOF
> ...
> +cat >test/expect <<-EOF

Likewise.

> @@ -219,152 +220,187 @@ cat > test/expect << EOF
>  EOF
>  
>  test_expect_success 'show -n' '
> -	(mv one one.unreachable &&
> -	 cd test &&
> ...
> +	mv one one.unreachable &&
> +	(
> +		cd test &&

This is more than an indentation change, but I think it is a good
one.  I saw some others that moved "mkdir" out of the subshell to
chdir into that directory, which are also good changes.

>  cat >test/expect <<\EOF

Funny that you did not touch this one.

> -cat > one/expect << EOF
> +cat >one/expect <<-\EOF
>    apis/master

But this again is an unnecessary use of <<-

This smells like a largely blind conversion done with a script,
which needs a human proof-reader other than the submitter;
everything else looked good.


I'll queue with this fix-up squashed in.


 t/t5505-remote.sh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index f679ded..0e7dfa2 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -107,7 +107,7 @@ test_expect_success C_LOCALE_OUTPUT 'remove remote' '
 		check_remote_track origin master side &&
 		git for-each-ref "--format=%(refname)" refs/remotes |
 		sed -e "/^refs\/remotes\/origin\//d" >actual &&
-		: >expect &&
+		>expect &&
 		test_cmp expect actual
 	)
 '
@@ -139,7 +139,7 @@ test_expect_success 'remove remote protects local branches' '
 	)
 '
 
-cat >test/expect <<-EOF
+cat >test/expect <<EOF
 * remote origin
   Fetch URL: $(pwd)/one
   Push  URL: $(pwd)/one
@@ -202,7 +202,7 @@ test_expect_success 'show' '
 	)
 '
 
-cat >test/expect <<-EOF
+cat >test/expect <<EOF
 * remote origin
   Fetch URL: $(pwd)/one
   Push  URL: $(pwd)/one
@@ -262,7 +262,7 @@ test_expect_success 'set-head --auto' '
 	)
 '
 
-cat >test/expect <<-\EOF
+cat >test/expect <<\EOF
 error: Multiple remote HEAD branches. Please choose one explicitly with:
   git remote set-head two another
   git remote set-head two master
@@ -276,7 +276,7 @@ test_expect_success 'set-head --auto fails w/multiple HEADs' '
 	)
 '
 
-cat >test/expect <<-\EOF
+cat >test/expect <<\EOF
 refs/remotes/origin/side2
 EOF
 
@@ -290,7 +290,7 @@ test_expect_success 'set-head explicit' '
 	)
 '
 
-cat >test/expect <<-EOF
+cat >test/expect <<EOF
 Pruning origin
 URL: $(pwd)/one
  * [would prune] origin/side2
@@ -483,7 +483,7 @@ EOF
 test_expect_success 'add with reachable tags (default)' '
 	(
 		cd one &&
-		: >foobar &&
+		>foobar &&
 		git add foobar &&
 		git commit -m "Foobar" &&
 		git tag -a -m "Foobar tag" foobar-tag &&
@@ -551,7 +551,7 @@ test_expect_success 'reject --no-no-tags' '
 	)
 '
 
-cat >one/expect <<-\EOF
+cat >one/expect <<\EOF
   apis/master
   apis/side
   drosophila/another
@@ -570,7 +570,7 @@ test_expect_success 'update' '
 	)
 '
 
-cat >one/expect <<-\EOF
+cat >one/expect <<\EOF
   drosophila/another
   drosophila/master
   drosophila/side
@@ -637,7 +637,7 @@ test_expect_success 'update default' '
 	)
 '
 
-cat >one/expect <<-\EOF
+cat >one/expect <<\EOF
   drosophila/another
   drosophila/master
   drosophila/side
@@ -732,7 +732,7 @@ test_expect_success 'rename a remote with name prefix of other remote' '
 	)
 '
 
-cat >remotes_origin <<-EOF
+cat >remotes_origin <<EOF
 URL: $(pwd)/one
 Push: refs/heads/master:refs/heads/upstream
 Pull: refs/heads/master:refs/heads/origin

  reply	other threads:[~2013-06-23  7:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-22  7:58 [PATCH v2 00/14] Classify {branches,remotes}-file as fringe features Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 01/14] t/t5505-remote: modernize style Ramkumar Ramachandra
2013-06-23  7:42   ` Junio C Hamano [this message]
2013-06-23  7:50     ` Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 02/14] t/t5505-remote: test push-refspec in branches-file Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 03/14] t/t5505-remote: use test_path_is_missing Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 04/14] t/t5505-remote: remove dependency on $origin_url Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 05/14] remote: remove dead code in read_branches_file() Ramkumar Ramachandra
2013-06-23  7:19   ` Junio C Hamano
2013-06-22  7:58 ` [PATCH v2 06/14] t/t5505-remote: test url-with-# in branches-file Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 07/14] t/t5516-fetch-push: don't use branches-file Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 08/14] ls-remote doc: fix example invocation on git.git Ramkumar Ramachandra
2013-06-23  7:22   ` Junio C Hamano
2013-06-23  7:53     ` Ramkumar Ramachandra
2013-06-23  8:04       ` Junio C Hamano
2013-06-22  7:58 ` [PATCH v2 09/14] ls-remote doc: rewrite <repository> paragraph Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 10/14] ls-remote doc: don't encourage use of branches-file Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 11/14] t/t5505-remote: test multiple push/pull in remotes-file Ramkumar Ramachandra
2013-06-23  8:07   ` Junio C Hamano
2013-06-23  8:28     ` Ramkumar Ramachandra
2013-06-23 21:49       ` Junio C Hamano
2013-06-22  7:58 ` [PATCH v2 12/14] t/t5510-fetch: don't use remotes-file Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 13/14] t/t5515-fetch-merge-logic: don't use {branches,remotes}-file Ramkumar Ramachandra
     [not found]   ` <CA+gHt1B1pKz5iU+9m_gi36u7g91qZqgdkY97WDAWjRGxu-Vjuw@mail.gmail.com>
2013-06-25 10:20     ` Ramkumar Ramachandra
2013-06-22  7:58 ` [PATCH v2 14/14] remote: add comment about read_{branches,remotes}_file Ramkumar Ramachandra

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=7vehbtgto1.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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).