Re: [PATCH v6 4/4] config: add '--show-origin' option to print the origin of a config value
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Mar 2, 2016, 17:33 UTC
- Message-ID
- <56D723F0.7020106@kdbg.org>
- In-Reply-To
- <1455873362-66998-5-git-send-email-larsxschneider@gmail.com>
Am 19.02.2016 um 10:16 schrieb larsxschneider@gmail.com:
Show 5 quoted lines
> +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
Show 10 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 > +'
...
Show 6 quoted lines
> +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.
Show 9 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 > +'
...
Show 5 quoted lines
> +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?
Show 9 quoted lines
> + 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 >