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

Re: [PATCH v6 4/4] config: add '--show-origin' option to print the origin of a config value

From
Lars Schneider <larsxschneider@gmail.com>
Date
Mar 3, 2016, 07:38 UTC
Message-ID
<07435444-0C35-4615-A403-9E124AFC9427@gmail.com>
In-Reply-To
<56D723F0.7020106@kdbg.org>
Show 12 quoted lines
> On 02 Mar 2016, at 18:33, Johannes Sixt <j6t@kdbg.org> wrote:
> 
> Am 19.02.2016 um 10:16 schrieb larsxschneider@gmail.com:
>> +test_expect_success '--show-origin with --list' '
>> +	cat >expect <<-EOF &&
>> +		file:$HOME/.gitconfig	user.global=true
>> +		file:$HOME/.gitconfig	user.override=global
>> +		file:$HOME/.gitconfig	include.path=$INCLUDE_DIR/absolute.include
> 
> On Windows, this injects POSIX-style paths in the expected output, but git.exe produces mangled paths (with a drive letter). The pattern I use to fix this is:
> 
> 		file:$(pwd)/.gitconfig	user.override=global
OK, I try to fix it that way.
Show 22 quoted lines
> 
>> +		file:$INCLUDE_DIR/absolute.include	user.absolute=include
>> +		file:.git/config	user.local=true
>> +		file:.git/config	user.override=local
>> +		file:.git/config	include.path=../include/relative.include
>> +		file:.git/../include/relative.include	user.relative=include
>> +		cmdline:	user.cmdline=true
>> +	EOF
>> +	git -c user.cmdline=true config --list --show-origin >output &&
>> +	test_cmp expect output
>> +'
> ...
>> +test_expect_success 'set up custom config file' '
>> +	CUSTOM_CONFIG_FILE="file\" (dq) and spaces.conf" &&
>> +	cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
>> +		[user]
>> +			custom = true
>> +	EOF
> 
> This fails on Windows, because the shell cannot create a file containing a double-quote character.
> 
> IIUC, the test serves two purposes: (1) to test C-style quoting of the output and (2) non-standard configuration files. We'll have to separate that so that we can test at least (2) on Windows with "regular" file name. We cannot test (1) because the only case where quoting is used is when the file name contains a double-quote character.
OK, I will try to separate this and disable (1) for Windows.
Show 18 quoted lines
> 
>> +'
>> +
>> +test_expect_success '--show-origin escape special file name characters' '
>> +	cat >expect <<-\EOF &&
>> +		file:"file\" (dq) and spaces.conf"	user.custom=true
>> +	EOF
>> +	git config --file "$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
>> +	test_cmp expect output
>> +'
> ...
>> +test_expect_success '--show-origin blob ref' '
>> +	cat >expect <<-\EOF &&
>> +		blob:"master:file\" (dq) and spaces.conf"	user.custom=true
>> +	EOF
>> +	git add "$CUSTOM_CONFIG_FILE" &&
> 
> Is this dual-purpose as well or just re-using the files established earlier in the test suite?
Just re-using files.
Thanks for making me aware of the Windows problems. I can reproduce them with the Git for Windows SDK (super easy to setup, great work Dscho!) and I will try to fix them.
I am fairly new to the Git for Windows SDK (+ an inexperienced Windows user) and therefore I wonder if you can help me with the following questions:
(1) If I have a Git core branch with a some changes that builds and tests clean on Linux and OSX. How do I apply all the necessary Git for Windows specific changes to this branch?

(2) During my testing with Windows I noticed that the git config paths look funny by adding ("\\" and "/"). I mentioned the problem in the Git for Windows forum: https://groups.google.com/forum/#!topic/git-for-windows/zTv60HhfnYk Duy suggested a solution in that thread. Is this the default way to deal with the paths? Would the list accept this solution?

(3) The tests on Windows seemed very slow to me. Are there tricks to speed them up? Did you try a RAM disk? If yes, how do you do it?

Thanks, Lars

Previous: Johannes SixtNext: Johannes Sixt
Message 10 of 17 in “config: add '--sources' option to print the source of a config value”
  1. 0/4 config: add '--sources' option to print the source of a config valuelarsxschneider@gmail.com, Feb 19, 2016
  2. 1/4 t: do not hide Git's exit code in tests using 'nul_to_q'larsxschneider@gmail.com, Feb 19, 2016
  3. 2/4 rename git_config_from_buf to git_config_from_memlarsxschneider@gmail.com, Feb 19, 2016
  4. 3/4 config: add 'origin_type' to config_source structlarsxschneider@gmail.com, Feb 19, 2016
  5. 4/4 config: add '--show-origin' option to print the origin of a config valuelarsxschneider@gmail.com, Feb 19, 2016
  6. Junio C HamanoFeb 22, 2016
  7. Jeff KingFeb 22, 2016
  8. Junio C HamanoFeb 22, 2016
  9. Johannes SixtMar 2, 2016
  10. Lars SchneiderMar 3, 2016
  11. Johannes SixtMar 3, 2016
  12. Johannes SchindelinMar 22, 2016
  13. Lars SchneiderMar 21, 2016
  14. Junio C HamanoFeb 19, 2016
  15. 0/2 config: add '--sources' option to print the source of a config valuelarsxschneider@gmail.com, Feb 22, 2016
  16. 1/2 fixup: config: add 'origin_type' to config_source structlarsxschneider@gmail.com, Feb 22, 2016
  17. 2/2 fixup: config: add '--show-origin' option to print the origin of a config valuelarsxschneider@gmail.com, Feb 22, 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.