Re: [PATCH v4] commit: add a commit.verbose config variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 11, 2016 at 11:14 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> 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!
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]