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, 07:00 UTC
Message-ID
<CAFZEwPPNMtopk9a3nVaCuujWoyeA5+39vEj3Mct1YckCXLh1-A@mail.gmail.com>
In-Reply-To
<CAPig+cTBxH7BAs2M+PBwTHfVJvH0ADL1OSEKdHQY59L-WiYosA@mail.gmail.com>
On Sun, Mar 27, 2016 at 9:04 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 11 quoted lines
> On Sat, Mar 26, 2016 at 3:48 PM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
>> Add commit.verbose configuration variable as a convenience for those
>> who always prefer --verbose taking care of multiple levels of verbosity.
>
> What does "taking care of multiple levels of verbosity" mean? I
> suppose you mean that commit.verbose specifies a verbosity level
> (rather than being merely boolean), but that phrase is difficult to
> decipher. And, since it's obvious from the patch itself that verbosity
> is not a mere boolean, there isn't really a need to mention it here.
> The commit message would be perfectly fine without that bit, so
> perhaps just drop it.
I will drop it.
Show 11 quoted lines
>> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
>>
>> ---
>> Changes with respect to the previous patch:
>>  - Fixed a status related bug pointed out by SZEDER
>>  - Change some tests
>
> Please help reviewers out by being a bit more verbose when describing
> the changes. For instance, what bug did you fix pointed out by SZEDER?
> And, "change some tests" says nothing useful. What did you change in
> the tests?
I will try and be more specific henceforth.
Show 14 quoted lines
>> ---
>> diff --git a/builtin/commit.c b/builtin/commit.c
>> @@ -1355,6 +1357,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)
>>         finalize_colopts(&s.colopts, -1);
>>         finalize_deferred_config(&s);
>>
>> +       if (verbose == -1)
>> +               verbose = 0;
>> +
>
> Nit: It might be good to drop the blank line above this new
> conditional to make it clear that it is part of the
> init_config/parse_options processing (the tail of which is visible in
> the context above).
Sure.
Show 31 quoted lines
>>         handle_untracked_files_arg(&s);
>>         if (show_ignored_in_status)
>>                 s.show_ignored_files = 1;
>> @@ -1654,6 +1664,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>>         argc = parse_and_validate_options(argc, argv, builtin_commit_options,
>>                                           builtin_commit_usage,
>>                                           prefix, current_head, &s);
>> +
>> +       if (verbose == -1)
>> +               verbose = (config_verbose == -1) ? 0 : config_verbose;
>> +
>
> Nit: For consistency, dropping the blank line above this new
> conditional wouldn't hurt either.
>
>>         if (dry_run)
>>                 return dry_run_commit(argc, argv, prefix, current_head, &s);
>>         index_file = prepare_index(argc, argv, prefix, current_head, 0);
>> diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
>> @@ -101,4 +101,52 @@ test_expect_success 'verbose diff is stripped out with set core.commentChar' '
>> +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?

Show 48 quoted lines
> More below...
>
>> +test_expect_success 'commit.verbose true and --verbose' '
>> +       git -c commit.verbose=true commit --amend --verbose &&
>> +       test_line_count = 1 out
>> +'
>> +
>> +test_expect_success 'commit.verbose true and -v -v' '
>> +       git -c commit.verbose=true commit --amend -v -v &&
>> +       test_line_count = 2 out
>> +'
>> +
>> +test_expect_success 'commit.verbose true and --no-verbose' '
>> +       git -c commit.verbose=true commit --amend --no-verbose &&
>> +       ! test -s out
>> +'
>> +
>> +test_expect_success 'commit.verbose false and --verbose' '
>> +       git -c commit.verbose=false commit --amend --verbose &&
>> +       test_line_count = 1 out
>> +'
>> +
>> +test_expect_success 'commit.verbose false and -v -v' '
>> +       git -c commit.verbose=false commit --amend -v -v &&
>> +       test_line_count = 2 out
>> +'
>> +
>> +test_expect_success 'commit.verbose false and --verbose omitted' '
>> +       git -c commit.verbose=false commit --amend &&
>> +       ! test -s out
>> +'
>> +
>> +test_expect_success 'commit.verbose false and --no-verbose' '
>> +       git -c commit.verbose=false commit --amend --no-verbose &&
>> +       ! test -s out
>> +'
>> +
>> +test_expect_success 'status ignores commit.verbose=true' '
>> +       git -c commit.verbose=true status >actual &&
>> +       ! grep "^diff --git" actual
>> +'
>
> The fact that v9 broke a number of tests in other scripts which use
> git-status (as SZEDER pointed out[1]), due to initializing 'verbose'
> to -1 in builtin/commit.c, suggests that you probably ought to add
> another test here to protect against that sort of breakage, as well.
> Specifically, git-status should remain non-verbose when neither
> commit.verbose nor --verbose is specified.
Yes, I should. I will include that.
>> +
>>  test_done
Previous: Eric SunshineNext: Eric Sunshine
Message 4 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.