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 21, 2016, 08:53 UTC
Message-ID
<E8903192-701B-4EE9-B804-B612EAAF7A45@gmail.com>
In-Reply-To
<56D723F0.7020106@kdbg.org>
On 02 Mar 2016, at 18:33, Johannes Sixt <j6t@kdbg.org> wrote:
Show 10 quoted lines
> 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
I tried that. But then I get this (notice the quotation marks):

-file:C:/git-sdk-64/usr/src/git/t/trash directory.t1300-repo-config/.gitconfig user.global=true +file:"C:\\git-sdk-64\\usr\\src\\git\\t\\trash directory.t1300-repo-config/.gitconfig" user.global=true

I am struggling to find a solution that works on all platforms. I see the following options:

(1) I detect MINGW in the test run and check for another string (2) I detect MINGW in the test run and change the output of 'git config --show-origin' with a regex (e.g. replace \\ with / and remote quotation marks) (3) I change the implementation of 'git config --show-origin' similar to [1]

If I get your comment ($gmane/288203) correctly then (3) wouldn't be a good idea. I think (1) would be the cleanest way. Do you have some pointers for me how Git for Windows solved these kind of problems in the past?

Thanks, Lars

[1] https://groups.google.com/forum/#!topic/git-for-windows/zTv60HhfnYk
Previous: Johannes SchindelinNext: Junio C Hamano
Message 13 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.