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

Re: [PATCH v2 1/2] t/README: document test_config

From
Firmin Martin <firminmartin24@gmail.com>
Date
May 17, 2021, 07:44 UTC
Message-ID
<87cztpg5yh.fsf@Inspiron.i-did-not-set--mail-host-address--so-tickle-me>
In-Reply-To
<5faaa5a6-8ebf-b2ef-805f-551a36ab7e6c@gmail.com>
Hi Bagas,
Bagas Sanjaya <bagasdotme@gmail.com> writes:
Show 9 quoted lines
> On 15/05/21 22.27, Firmin Martin wrote:
>>   
>> + - test_config <config-option> [<value>]
>> +
>> +   Set the configuration option <config-option> to <value>, and unset it at the
>> +   end of the current test. For a similar purpose, test_config_global for
>> +   global configuration is also available. Note, however, that test_config_*
>> +   must not be used in a subshell.
>> +
>  From the syntax above, when I omit <value>, default value for <config-option>
> will be set, right? 

Good remark. I thought the same as you, but no, it will "git config <config-option>" (query the value of <config-option>) and then "git config --unset <config-option>" which is dangerous. Doing so is more likely an error and should be forbidden, as in this case, it is equivalent to test_unconfig <config-option>. Will reflect this in v3.

> You forgot to mention it.
I'll thus drop square brackets.
Show 20 quoted lines
>> +   Example:
>> +
>> +	test_config format.coverLetter auto
>> +
>> +   Is a concise way to write:
>> +	test_when_finished "git config --unset format.coverLetter" &&
>> +	git config format.coverLetter auto
>> +
>>   
>
> The description said "set the config, then unset it". But the expanded version
> said "unsetting the config is deferred to the end of test and set the config".
>
> The documentation for test_when_finished said:
>
>>    Prepend <script> to a list of commands to run to clean up
>>    at the end of the current test.  If some clean-up command
>>    fails, the test will not pass.
>
> Is my interpretation above correct?
Yes.
> Oh yeah, maybe it's better to say:
> "For example: <blah> have the same effect as <blah>."

I agree, because the two lines have not exactly the same behaviour as test_config. Will fix wording.

Thanks,
Firmin
Previous: Bagas SanjayaNext: Firmin Martin
Message 11 of 15 in “t/README: document test_config”
  1. 1/2 t/README: document test_configFirmin Martin, May 14, 2021
  2. 2/2 t: use test_config whenever possibleFirmin Martin, May 14, 2021
  3. Felipe ContrerasMay 15, 2021
  4. Felipe ContrerasMay 15, 2021
  5. Firmin MartinMay 15, 2021
  6. Eric SunshineMay 14, 2021
  7. Firmin MartinMay 15, 2021
  8. 0/2 document test_config & use it whenever possibleFirmin Martin, May 15, 2021
  9. 1/2 t/README: document test_configFirmin Martin, May 15, 2021
  10. Bagas SanjayaMay 16, 2021
  11. Firmin MartinMay 17, 2021
  12. 2/2 t: use test_config whenever possibleFirmin Martin, May 15, 2021
  13. Junio C HamanoMay 16, 2021
  14. Firmin MartinMay 17, 2021
  15. Junio C HamanoMay 17, 2021

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.