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

Re: [PATCH v8 2/2] commit: add a commit.verbose config variable

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Mar 20, 2016, 18:02 UTC
Message-ID
<CAFZEwPNKozf+owtJtaE27MqQb3koL0L=HDnErVoWrTnQpieGgw@mail.gmail.com>
In-Reply-To
<CAPig+cSCrdxYb=0WOiAARrrPK07PeyTKsopPfwDOLAO4m3scnQ@mail.gmail.com>
On Sun, Mar 20, 2016 at 11:04 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 39 quoted lines
> On Sun, Mar 20, 2016 at 7:05 AM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
>> On Sun, Mar 20, 2016 at 9:26 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> However, more intuitive would probably be to create another "editor"
>>> similar to the 'check-for-diff' editor this script already uses. (The
>>> 'check-for-diff' editor is an obvious example about how to go about
>>> such an undertaking.) You would need to invoke 'test_set_editor' in a
>>> subshell for this particular test in order to avoid clobbering the
>>> global editor used by this script. Or, have a preparatory patch which
>>> ditches the global setting of the editor and has each test invoke
>>> 'test_set_editor' as needed (and only if needed).
>>
>> I guess it would complicate things as sometimes I need to check
>> whether it has 1 line and sometimes 2 lines.
>
> It's not really a big complication. If I'm reading the patch
> correctly, you should be able to re-use the existing check-for-diff
> "editor" for the first of the new tests for which you're currently
> setting a custom GIT_EDITOR. To do so, you will need to modify
> check-for-diff to also count lines and assert that only one was found,
> which should work for the new test and continue working for the
> existing tests.
>
> Then, you just need to create one more "editor" for the two tests
> where you set custom GIT_EDITOR and expect two lines.
>
> By the way, I forgot to mention in the review that, rather than:
>
>     wc -l out | grep "1"
>
> for counting lines in a test script, you'd use:
>
>     test_line_count = 1 out
>
> However, if you're doing it in an "editor" (which I recommend), then you'd use:
>
>     test $(wc -l <out) = 1
>
> And, another "by the way": You can use the write_script() function to
> simplify creation of the new "editor(s)".
Thanks for a detailed explanation.
Show 17 quoted lines
> In fact, it would be nice to convert creation of the check-for-diff
> "editor" to use write_script, as well. So, basically, I'm suggesting
> splitting the current patch into three, where the first two are
> preparatory cleanups:
>
> 1. use write_script() to create the check-for-diff "editor" rather
> than creating it manually
>
> 2. drop the global test_set_editor() and instead have each test invoke
> it as needed (and only if needed)
>
> 3. the current patch which adds new tests along with a new "editor"
>
> Alternatively, combine #1 and #2 into a single patch which drops the
> global test_set_editor() and, as an aside, also does "while here,
> let's use write_script() to create 'check-for'diff' rather than doing
> so manually".
These changes seem nice. I will update and send the patch.
Previous: Eric SunshineNext: Junio C Hamano
Message 6 of 11 in “parse-options.c: make OPTION__COUNTUP consider negative values”
  1. 1/2 parse-options.c: make OPTION__COUNTUP consider negative valuesPranit Bauva, Mar 18, 2016
  2. 2/2 commit: add a commit.verbose config variablePranit Bauva, Mar 18, 2016
  3. Eric SunshineMar 20, 2016
  4. Pranit BauvaMar 20, 2016
  5. Eric SunshineMar 20, 2016
  6. Pranit BauvaMar 20, 2016
  7. Junio C HamanoMar 23, 2016
  8. Pranit BauvaMar 23, 2016
  9. Junio C HamanoMar 23, 2016
  10. Junio C HamanoMar 18, 2016
  11. Pranit BauvaMar 19, 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.