git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Mar 11, 2016, 08:00 UTC
Message-ID
<CAFZEwPPbF30fr97WdZdbHwrF-b2VGkYiyTr3dDfdOAXd2SGFkQ@mail.gmail.com>
In-Reply-To
<20160311054412.GA10841@flurp.local>
On Fri, Mar 11, 2016 at 11:14 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 8 quoted lines
> 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.

Show 22 quoted lines
> 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!

Previous: Eric SunshineNext: Roberto Tyley
Message 8 of 13 in “commit: add a commit.verbose config variable”
  1. commit: add a commit.verbose config variablePranit Bauva, Mar 10, 2016
  2. Pranit BauvaMar 10, 2016
  3. Junio C HamanoMar 10, 2016
  4. Pranit BauvaMar 10, 2016
  5. Eric SunshineMar 10, 2016
  6. Pranit BauvaMar 11, 2016
  7. Eric SunshineMar 11, 2016
  8. Pranit BauvaMar 11, 2016
  9. Roberto TyleyMar 11, 2016
  10. Philip OakleyMar 11, 2016
  11. t/t7502 : drop duplicate testPranit Bauva, Mar 11, 2016
  12. Pranit BauvaMar 11, 2016
  13. Junio C HamanoMar 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.