git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 16, 2014, 02:12 UTC
Message-ID
<CAPig+cSRgpABwzC36FoBst52hCOPieMBTvsTx9CPFoHifHG9yg@mail.gmail.com>
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:

Show 22 quoted lines
> 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.
Show 15 quoted lines
> +       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
Previous: Kirill A. ShutemovNext: Kirill A. Shutemov
Message 4 of 8 in “builtin/config.c: rename check_blob_write() -> check_write()”
  1. 1/3 builtin/config.c: rename check_blob_write() -> check_write()Kirill A. Shutemov, Feb 14, 2014
  2. 2/3 config: change git_config_with_options() interfaceKirill A. Shutemov, Feb 14, 2014
  3. 3/3 config: teach "git config --file -" to read from the standard inputKirill A. Shutemov, Feb 14, 2014
  4. Eric SunshineFeb 16, 2014
  5. config: teach "git config --file -" to read from the standard inputKirill A. Shutemov, Feb 16, 2014
  6. Jeff KingFeb 18, 2014
  7. Junio C HamanoFeb 18, 2014
  8. Junio C HamanoFeb 18, 2014

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.