git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pranit Bauva <pranit.bauva@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, Roberto Tyley <robertotyley@gmail.com>
Subject: Re: [PATCH v4] commit: add a commit.verbose config variable
Date: Fri, 11 Mar 2016 13:30:32 +0530	[thread overview]
Message-ID: <CAFZEwPPbF30fr97WdZdbHwrF-b2VGkYiyTr3dDfdOAXd2SGFkQ@mail.gmail.com> (raw)
In-Reply-To: <20160311054412.GA10841@flurp.local>

On Fri, Mar 11, 2016 at 11:14 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:

> It's a bit tricky if you're not used to it, but check-for-diff
> actually does what you want, and does so in a more direct way. While
> it's true that it's not an "editor" per se, it does get access to the
> entire block of text that would normally appear in your editor during
> an interactive commit. And, this is happening before the commit has
> been written to history. So, check-for-diff gets a chance to look at
> the full text that would appear in your editor, and can therefore
> check if it contains the expected "diff --git" string.

Yes, this was new to me. Thanks for explaining it in an elaborate
manner. It took me some time to actually understand the behavior of
check-for-diff (a tricky one). And it does the task pretty nicely!

> 'test_i18ngrep' is intended for strings which may be translated,
> however, since the expected "diff --git" string should never be
> translated, check-for-diff's use of 'grep' is correct, whereas
> 'test_i18ngrep' would be misleading (if not actively wrong).

I should have read the docs before using this method and not just
blindly using it. I will definitely take care of that next time.

> As an experiment, I rewrote the four new tests in terms of
> check-for-diff (with "test_set_editor check-for-diff" already in
> effect). Here's what they look like, and they function as expected:
>
>     test_expect_success 'commit.verbose true and --verbose omitted' '
>         git -c commit.verbose=true commit --amend
>     '
>
>     test_expect_success 'commit.verbose true and --no-verbose' '
>         test_must_fail git -c commit.verbose=true commit --amend --no-verbose
>     '
>
>     test_expect_success 'commit.verbose false and --verbose' '
>         git -c commit.verbose=false commit --amend --verbose
>     '
>
>     test_expect_success 'commit.verbose false and --verbose omitted' '
>         test_must_fail git -c commit.verbose=false commit --amend
>     '
>
> These are modeled after the "initial commit shows verbose diff" test
> earlier in the script.

Thanks a lot for helping me with the tests. I will add the status
tests and then resend the patch. This was a nice exercise!

  reply	other threads:[~2016-03-11  8:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 22:12 [PATCH v4] commit: add a commit.verbose config variable Pranit Bauva
2016-03-10 22:39 ` Pranit Bauva
2016-03-10 22:52 ` Junio C Hamano
2016-03-10 23:02   ` Pranit Bauva
2016-03-10 23:01 ` Eric Sunshine
2016-03-11  0:15   ` Pranit Bauva
2016-03-11  5:44     ` Eric Sunshine
2016-03-11  8:00       ` Pranit Bauva [this message]
2016-03-11  9:39       ` Roberto Tyley
2016-03-11 10:18     ` Philip Oakley
2016-03-11  0:49 ` [PATCH v2] t/t7502 : drop duplicate test Pranit Bauva
2016-03-11  5:09   ` Pranit Bauva
2016-03-11 18:39   ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFZEwPPbF30fr97WdZdbHwrF-b2VGkYiyTr3dDfdOAXd2SGFkQ@mail.gmail.com \
    --to=pranit.bauva@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robertotyley@gmail.com \
    --cc=sunshine@sunshineco.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.
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 NNTP newsgroup(s).