git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	Paul Tan <pyokagan@gmail.com>
Subject: Re: [PATCH v2] am: add am.signoff add config variable
Date: Wed, 28 Dec 2016 10:51:28 -0800	[thread overview]
Message-ID: <CAGZ79kaBpC5ym2N_fMZHDmL4gGpU8pFAsupCE4aTdENh+=z72g@mail.gmail.com> (raw)
In-Reply-To: <20161228183501.15068-1-ehabkost@redhat.com>

On Wed, Dec 28, 2016 at 10:35 AM, Eduardo Habkost <ehabkost@redhat.com> wrote:
> git-am has options to enable --message-id and --3way by default,
> but no option to enable --signoff by default. Add a "am.signoff"
> config option.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * Added documentation to Documentation/git-am.txt and
>   Documentation/config.txt
> * Added test cases to t4150-am.sh

Thanks!
Documentation and code looks good to me, for the test a small nit below.

> +test_expect_success '--no-signoff overrides am.signoff' '
> +       rm -fr .git/rebase-apply &&
> +       git reset --hard first &&
> +       test_config am.signoff true &&
> +       git am --no-signoff <patch2 &&
> +       printf "%s\n" "$signoff" >expected &&

"expected" is never read in this test, so we can omit this line?

> +       git cat-file commit HEAD^ | grep "Signed-off-by:" >actual &&

So we check if the previous commit is not tampered with,

> +       test $(git cat-file commit HEAD | grep -c "Signed-off-by:") -eq 0

and then we check if the top most commit has zero occurrences
for lines grepped for sign off. That certainly works, but took me a
while to understand (TIL about -c in grep :).

Another way that to write this check, that Git regulars may be more used to is:

    git cat-file commit HEAD | grep "Signed-off-by:" >actual
    test_must_be_empty actual

I would have suggested to grep for $signoff instead of "Signed-off-by:",
but it turns out being fuzzy here is better and would also catch e.g.
a broken sign off.

> +test_expect_success 'am.signoff adds Signed-off-by: line' '
> +       rm -fr .git/rebase-apply &&
> +       git reset --hard first &&
> +       test_config am.signoff true &&
> +       git am <patch2 &&
> +       printf "%s\n" "$signoff" >expected &&
> +       echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >>expected &&
> +       git cat-file commit HEAD^ | grep "Signed-off-by:" >actual &&
> +       test_cmp expected actual &&
> +       echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&
> +       git cat-file commit HEAD | grep "Signed-off-by:" >actual &&
> +       test_cmp expected actual
> +'

This test looks good to me,

Thanks,
Stefan

  reply	other threads:[~2016-12-28 18:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 18:35 [PATCH v2] am: add am.signoff add config variable Eduardo Habkost
2016-12-28 18:51 ` Stefan Beller [this message]
2016-12-28 19:11   ` Eduardo Habkost
2016-12-28 19:19     ` Eduardo Habkost
2016-12-28 19:24       ` Stefan Beller
2016-12-29  7:59       ` Pranit Bauva
2016-12-29 15:37         ` Eduardo Habkost
2016-12-28 19:07 ` Andreas Schwab
2016-12-28 19:12   ` Eduardo Habkost

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='CAGZ79kaBpC5ym2N_fMZHDmL4gGpU8pFAsupCE4aTdENh+=z72g@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=ehabkost@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=pyokagan@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).