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

Re: [PATCH v10 3/3] commit: add a commit.verbose config variable

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Mar 27, 2016, 08:40 UTC
Message-ID
<CAFZEwPMSpJGgTeHm41FYXiXgx7whFT0BsqUEBJ2ZJOsfydKxVw@mail.gmail.com>
In-Reply-To
<CAPig+cStkyOE4MwmFpq9V8h5M=6j=FWbDTkyMGXZsf8sBH=9pg@mail.gmail.com>
On Sun, Mar 27, 2016 at 1:47 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 29 quoted lines
> On Sun, Mar 27, 2016 at 3:00 AM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
>> On Sun, Mar 27, 2016 at 9:04 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> On Sat, Mar 26, 2016 at 3:48 PM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
>>>> +test_expect_success 'commit.verbose true and --verbose omitted' '
>>>> +       echo content >file2 &&
>>>> +       echo content >>file &&
>>>> +       git add file2 &&
>>>> +       git -c commit.verbose=true commit -F message &&
>>>> +       test_line_count = 1 out
>>>> +'
>>>
>>> Why is this test so utterly different than it was in v9 (even though
>>> the title is the same), and why is it so different from other tests
>>> below?
>>
>> This is because the "editor" in v9 checked for "# Changes"... While
>> this "editor" checks for 'diff --git'. And submodules don't give a
>> proper diff to verify (I tried this out and noticed this behavior by
>> tweaking some parts). In fact submodules don't give diff at all. But
>> they do give "# Changes"... So its important to setup up a little
>> before getting started. If this seems unnecessary, then should I move
>> all the tests which were introduced here above the submodule test?
>
> Let's ignore submodules when discussing this since they don't need to
> factor into the issue. What you are actually saying (and what took me
> a while to understand due to the "submodules" misdirection) is that
> you need to do some additional setup to test the "-v -v" cases. In
> particular, you need to introduce some change to the worktree which is
> not in the index.

Sorry for the misdirection. And you understood correctly. I do need to introduce some changes in worktree.

Show 18 quoted lines
> The typical way to satisfy this requirement (which doesn't require
> relocating tests) is to add a "setup" test before the tests which
> depend upon that additional setup, rather than adding that setup to
> the first test which needs it. Just about the simplest setup test
> which satisfies your needs is the following (inserted just before the
> first of the new tests):
>
>     test_expect_success 'setup -v -v' '
>         echo dirty >file
>     '
>
> And, then you can restore the "commit.verbose true and --verbose
> omitted" test to its simple form:
>
>     test_expect_success 'commit.verbose true and --verbose omitted' '
>         git -c commit.verbose=true commit --amend &&
>         test_line_count = 1 out
>     '
Having a additional setup test seems a nice way to go about.
Show 16 quoted lines
> By the way, now that commit.verbose is no longer a mere boolean,
> you're going to need some additional tests beyond the
> commit.verbose={true,false} ones you've already added. In particular,
> you should be testing commit.verbose with several numeric values to
> verify that it works as expected. For instance:
>
>     commit.verbose=-2
>     commit.verbose=-1
>     commit.verbose=0
>     commit.verbose=1
>     commit.verbose=2
>     commit.verbose=3
>
> The -2 case is interesting; I'm pretty sure the current implementation
> of this patch will misbehave since the only negative value it's
> expecting 'config_verbose' to be is -1.

-2 case will fail. I should probably expect 'config_verbose' to be negative instead.

Previous: Eric SunshineNext: SZEDER Gábor
Message 6 of 35 in “parse-options.c: make OPTION__COUNTUP understand "unspecified" values”
  1. 1/3 parse-options.c: make OPTION__COUNTUP understand "unspecified" valuesPranit Bauva, Mar 26, 2016
  2. 3/3 commit: add a commit.verbose config variablePranit Bauva, Mar 26, 2016
  3. Eric SunshineMar 27, 2016
  4. Pranit BauvaMar 27, 2016
  5. Eric SunshineMar 27, 2016
  6. Pranit BauvaMar 27, 2016
  7. SZEDER GáborMar 27, 2016
  8. Pranit BauvaMar 27, 2016
  9. SZEDER GáborMar 27, 2016
  10. Pranit BauvaMar 27, 2016
  11. Eric SunshineMar 27, 2016
  12. 2/3 t7507-commit-verbose: store output of grep in a filePranit Bauva, Mar 26, 2016
  13. Eric SunshineMar 27, 2016
  14. SZEDER GáborMar 27, 2016
  15. Pranit BauvaMar 27, 2016
  16. Eric SunshineMar 27, 2016
  17. Pranit BauvaMar 27, 2016
  18. Eric SunshineMar 27, 2016
  19. Pranit BauvaMar 27, 2016
  20. 1/4 test-parse-options: print quiet as integerPranit Bauva, Mar 31, 2016
  21. 3/4 t7507-commit-verbose: improve test coverage by testing number of diffsPranit Bauva, Mar 31, 2016
  22. Junio C HamanoMar 31, 2016
  23. Pranit BauvaMar 31, 2016
  24. 2/4 parse-options.c: make OPTION_COUNTUP respect "unspecified" valuesPranit Bauva, Mar 31, 2016
  25. Junio C HamanoMar 31, 2016
  26. Pranit BauvaMar 31, 2016
  27. Junio C HamanoMar 31, 2016
  28. Pranit BauvaMar 31, 2016
  29. Junio C HamanoMar 31, 2016
  30. 4/4 commit: add a commit.verbose config variablePranit Bauva, Mar 31, 2016
  31. Junio C HamanoMar 31, 2016
  32. Pranit BauvaMar 31, 2016
  33. Eric SunshineMar 27, 2016
  34. Eric SunshineMar 27, 2016
  35. Eric SunshineMar 27, 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.