git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: larsxschneider@gmail.com
Cc: git@vger.kernel.org, peff@peff.net, ramsay@ramsayjones.plus.com,
	gitster@pobox.com, Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v6 4/4] config: add '--show-origin' option to print the origin of a config value
Date: Wed, 2 Mar 2016 18:33:36 +0100	[thread overview]
Message-ID: <56D723F0.7020106@kdbg.org> (raw)
In-Reply-To: <1455873362-66998-5-git-send-email-larsxschneider@gmail.com>

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

> +		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.

> +'
> +
> +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?

> +	git commit -m "new config file" &&
> +	git config --blob=master:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
> +	test_cmp expect output
> +'
> +
>   test_done
> --
> 2.5.1
>

  parent reply	other threads:[~2016-03-02 17:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19  9:15 [PATCH v6 0/4] config: add '--sources' option to print the source of a config value larsxschneider
2016-02-19  9:15 ` [PATCH v6 1/4] t: do not hide Git's exit code in tests using 'nul_to_q' larsxschneider
2016-02-19  9:16 ` [PATCH v6 2/4] rename git_config_from_buf to git_config_from_mem larsxschneider
2016-02-19  9:16 ` [PATCH v6 3/4] config: add 'origin_type' to config_source struct larsxschneider
2016-02-19  9:16 ` [PATCH v6 4/4] config: add '--show-origin' option to print the origin of a config value larsxschneider
2016-02-22 17:43   ` Junio C Hamano
2016-02-22 17:58     ` Jeff King
2016-02-22 18:37       ` Junio C Hamano
2016-03-02 17:33   ` Johannes Sixt [this message]
2016-03-03  7:38     ` Lars Schneider
2016-03-03 18:36       ` Johannes Sixt
2016-03-22 14:44       ` Johannes Schindelin
2016-03-21  8:53     ` Lars Schneider
2016-02-19 18:26 ` [PATCH v6 0/4] config: add '--sources' option to print the source " Junio C Hamano
2016-02-22  9:23   ` [PATCH v6 squash 0/2] " larsxschneider
2016-02-22  9:23     ` [PATCH v7 1/2] fixup: config: add 'origin_type' to config_source struct larsxschneider
2016-02-22  9:23     ` [PATCH v7 2/2] fixup: config: add '--show-origin' option to print the origin of a config value larsxschneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D723F0.7020106@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    --cc=peff@peff.net \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).