Re: [PATCH 3/3] config: teach "git config --file -" to read from the standard input

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 14, 2014 at 6:37 PM, Kirill A. Shutemov
<kirill@xxxxxxxxxxxxx> wrote:
> The patch extends git config --file interface to allow read config from
> stdin.
>
> Editing stdin or setting value in stdin is an error.
>
> Include by absolute path is allowed in stdin config, but not by relative
> path.
>
> Signed-off-by: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>
> ---
> diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
> index a70707620f14..fda6555024c5 100755
> --- a/t/t1305-config-include.sh
> +++ b/t/t1305-config-include.sh
> @@ -122,6 +122,20 @@ test_expect_success 'relative includes from command line fail' '
>         test_must_fail git -c include.path=one config test.one
>  '
>
> +test_expect_success 'absolute includes from stdin work' '
> +       echo "[test]one = 1" >one &&
> +       echo 1 >expect &&
> +       echo "[include]path=\"$PWD/one\"" |

To be Windows-friendly, you may want to use $(pwd). Quoting from t/README:

   When a test checks for an absolute path that a git command generated,
   construct the expected value using $(pwd) rather than $PWD,
   $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on
   Windows, where the shell (MSYS bash) mangles absolute path names.
   For details, see the commit message of 4114156ae9.

> +       git config --file - test.one >actual &&
> +       test_cmp expect actual
> +'
> +
> +test_expect_success 'relative includes from stdin line fail' '
> +       echo "[test]one = 1" >one &&
> +       echo "[include]path=one" |
> +       test_must_fail git config --file - test.one
> +'
> +
>  test_expect_success 'include cycles are detected' '
>         cat >.gitconfig <<-\EOF &&
>         [test]value = gitconfig
> --
> 1.8.5.2
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]