git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] config: teach "git config --file -" to read from the standard input
Date: Sat, 15 Feb 2014 21:12:29 -0500	[thread overview]
Message-ID: <CAPig+cSRgpABwzC36FoBst52hCOPieMBTvsTx9CPFoHifHG9yg@mail.gmail.com> (raw)
In-Reply-To: <1392421053-937-3-git-send-email-kirill@shutemov.name>

On Fri, Feb 14, 2014 at 6:37 PM, Kirill A. Shutemov
<kirill@shutemov.name> 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@shutemov.name>
> ---
> 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

  reply	other threads:[~2014-02-16  2:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 23:37 [PATCH 1/3] builtin/config.c: rename check_blob_write() -> check_write() Kirill A. Shutemov
2014-02-14 23:37 ` [PATCH 2/3] config: change git_config_with_options() interface Kirill A. Shutemov
2014-02-14 23:37 ` [PATCH 3/3] config: teach "git config --file -" to read from the standard input Kirill A. Shutemov
2014-02-16  2:12   ` Eric Sunshine [this message]
2014-02-16 12:13     ` [PATCH] " Kirill A. Shutemov
2014-02-18  8:41       ` Jeff King
2014-02-18 19:15         ` Junio C Hamano
2014-02-18 23:02           ` Junio C Hamano

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=CAPig+cSRgpABwzC36FoBst52hCOPieMBTvsTx9CPFoHifHG9yg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=kirill@shutemov.name \
    /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).