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

Re: [PATCH v6 1/4] commit test: Use test_config instead of git-config

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 17, 2014, 21:31 UTC
Message-ID
<xmqq8uovkytq.fsf@gitster.dls.corp.google.com>
In-Reply-To
<a7aa2efcb6a2beba973c389f5c7afbce79ec9747.1403033723.git.caleb@calebthompson.io>
Caleb Thompson <caleb@calebthompson.io> writes:
> Some of the tests in t/t7507-commit-verbose.sh were still using
> git-config to set configuration. Change them to use the test_config
> helper.

"were still using" is only a half of the story, and we need to be more careful than that, though.

Show 16 quoted lines
> Signed-off-by: Caleb Thompson <caleb@calebthompson.io>
> Reviewed-by: Jeremiah Mahler <jmmahler@gmail.com>
> ---
>  t/t7507-commit-verbose.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
> index 2ddf28c..6d778ed 100755
> --- a/t/t7507-commit-verbose.sh
> +++ b/t/t7507-commit-verbose.sh
> @@ -43,7 +43,7 @@ test_expect_success 'verbose diff is stripped out' '
>  '
>  
>  test_expect_success 'verbose diff is stripped out (mnemonicprefix)' '
> -	git config diff.mnemonicprefix true &&
> +	test_config diff.mnemonicprefix true &&

By switching to test_config, you unconfigure the diff.mnemonicprefix configuration after this test piece is done. The next one, "diff in message is retained with -v", used to show the change using c/ and i/ as prefixes in the log editor, but now it should be showing a/ and b/.

Have you thought about the reason why the log message used in that test uses c/ and i/ prefixes as a sample patch to be retained, instead of a/ and b/ prefixes? It is to make sure that this in-message patch looks similar to the diff for "--verbose" option, and we used to do the latter under mnemonicprefix. That way, we would be more sure that an incorrect implementation that cuts the result given from the editor at "diff --git $srcprefix/" will fail the test.

This is the kind of thing I mean by "we need to be more careful".

If somebody who is doing "git config to test_config" conversion understands what he is doing, I would have expected to see that these c/ and i/ prefixes in the sample log message are replaced to use a/ and b/ prefixes.

Show 12 quoted lines
>  	git commit --amend -v &&
>  	check_message message
>  '
> @@ -71,7 +71,7 @@ test_expect_success 'diff in message is retained with -v' '
>  '
>  
>  test_expect_success 'submodule log is stripped out too with -v' '
> -	git config diff.submodule log &&
> +	test_config diff.submodule log &&
>  	git submodule add ./. sub &&
>  	git commit -m "sub added" &&
>  	(

Can we make a similar reasoning on possible fallout from this change? An expected answer would be something like:

    The remaining test pieces after this one does not make any
    change before running "commit -a -v", so having diff.submodule
    set to log or unset does not make any difference to them.
Previous: Caleb ThompsonNext: Junio C Hamano
Message 3 of 12 in “commit: Add commit.verbose configuration”
  1. 0/4 commit: Add commit.verbose configurationCaleb Thompson, Jun 17, 2014
  2. 1/4 commit test: Use test_config instead of git-configCaleb Thompson, Jun 17, 2014
  3. Junio C HamanoJun 17, 2014
  4. Junio C HamanoJun 17, 2014
  5. 2/4 commit test: Use write_scriptCaleb Thompson, Jun 17, 2014
  6. 3/4 commit test: test_set_editor in each testCaleb Thompson, Jun 17, 2014
  7. 4/4 commit: Add commit.verbose configurationCaleb Thompson, Jun 17, 2014
  8. Jeff KingJun 17, 2014
  9. Junio C HamanoJun 17, 2014
  10. Jeff KingJun 17, 2014
  11. Torstein HeggeFeb 27, 2015
  12. Caleb ThompsonMar 2, 2015

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.