git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jiang Xin <worldhello.net@gmail.com>
To: BoJun via GitGitGadget <gitgitgadget@gmail.com>,
	Git List <git@vger.kernel.org>, BoJun <bojun.cbj@gmail.com>
Cc: "Chen Bojun" <bojun.cbj@alibaba-inc.com>,
	澳明 <tenglong.tl@alibaba-inc.com>
Subject: Re: [PATCH] receive-pack: purge temporary data if no command is ready to run
Date: Tue, 25 Jan 2022 08:22:19 +0800	[thread overview]
Message-ID: <CANYiYbGJc6RStoCfJjh0Y3BzQ1QdnoN_xSFz4keYVik1dq0cnw@mail.gmail.com> (raw)
In-Reply-To: <pull.1124.git.1642987616372.gitgitgadget@gmail.com>

On Mon, Jan 24, 2022 at 11:12 PM BoJun via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> -mk_empty () {
> +mk_empty() {

That's wrong. We prefer a space between the function name and the
parentheses for shell script, see:

 * https://github.com/git/git/blob/master/Documentation/CodingGuidelines#L138

>         repo_name="$1"
>         rm -fr "$repo_name" &&
> -       mkdir "$repo_name" &&
> -       (
> -               cd "$repo_name" &&
> -               git init &&
> -               git config receive.denyCurrentBranch warn &&
> -               mv .git/hooks .git/hooks-disabled
> -       )
> +               mkdir "$repo_name" &&
> +               (
> +                       cd "$repo_name" &&
> +                               git init &&
> +                               git config receive.denyCurrentBranch warn &&
> +                               mv .git/hooks .git/hooks-disabled
> +               )

The indent your made is ugly.

>  }
>
> -mk_test () {
> +mk_test() {
>         repo_name="$1"
>         shift
>
>         mk_empty "$repo_name" &&
> -       (
> -               for ref in "$@"
> -               do
> -                       git push "$repo_name" $the_first_commit:refs/$ref ||
> -                       exit
> -               done &&
> -               cd "$repo_name" &&
> -               for ref in "$@"
> -               do
> -                       echo "$the_first_commit" >expect &&
> -                       git show-ref -s --verify refs/$ref >actual &&
> -                       test_cmp expect actual ||
> -                       exit
> -               done &&
> -               git fsck --full
> -       )
> +               (
> +                       for ref in "$@"; do

Code style of the original is goold, yours is bad. See:

 * https://github.com/git/git/blob/master/Documentation/CodingGuidelines#L100

> +                               done &&
> +                               git fsck --full
> +               )
>  }
>
>  mk_test_with_hooks() {

This is the place you can fix by adding a space between the function
name and the parentheses.

> +               (
> +                       cd "$repo_name" &&
> +                               mkdir .git/hooks &&
> +                               cd .git/hooks &&
> +                               cat >pre-receive <<-'EOF' &&
> +                                       #!/bin/sh
> +                                       cat - >>pre-receive.actual

Too deep indent. The original implementation is good, yours is bad.

>
> -for head in HEAD @
> -do
> +for head in HEAD @; do

Bad coding style, please read through the "CodingGuidelines" for bash.

--
Jiang Xin

  parent reply	other threads:[~2022-01-25  4:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24  1:26 [PATCH] receive-pack: purge temporary data if no command is ready to run BoJun via GitGitGadget
2022-01-24 15:17 ` Ævar Arnfjörð Bjarmason
2022-01-25 16:34   ` Lertz Chen
2022-01-24 23:32 ` Junio C Hamano
2022-01-25 16:49   ` Bojun Chen
2022-01-25  0:22 ` Jiang Xin [this message]
2022-01-29  6:35 ` [PATCH v2] " Chen BoJun
2022-02-01 22:51   ` Junio C Hamano
2022-02-01 23:27     ` Junio C Hamano
2022-02-05  7:17     ` Bojun Chen
2022-02-05  8:04       ` Junio C Hamano
2022-02-07  3:36       ` Jiang Xin
2022-02-07  8:02         ` Bojun Chen
2022-02-04  1:17   ` Junio C Hamano
2022-02-05  7:19     ` Bojun Chen
2022-02-05  8:02       ` Junio C Hamano
2022-02-07  7:57 ` [PATCH v3 0/1] " Chen BoJun
2022-02-07  7:57   ` [PATCH v3 1/1] receive-pack: " Chen BoJun

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=CANYiYbGJc6RStoCfJjh0Y3BzQ1QdnoN_xSFz4keYVik1dq0cnw@mail.gmail.com \
    --to=worldhello.net@gmail.com \
    --cc=bojun.cbj@alibaba-inc.com \
    --cc=bojun.cbj@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=tenglong.tl@alibaba-inc.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).