From: Junio C Hamano <gitster@pobox.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] config: git_config_from_file(): handle "-" filename as stdin
Date: Fri, 14 Feb 2014 10:27:11 -0800 [thread overview]
Message-ID: <xmqqlhxdim80.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1392384878-7080-1-git-send-email-kirill@shutemov.name> (Kirill A. Shutemov's message of "Fri, 14 Feb 2014 15:34:38 +0200")
"Kirill A. Shutemov" <kirill@shutemov.name> writes:
> The patch extends git config --file interface to allow read config from
> stdin.
Thanks. The external interface proposed by this change that behaves
the way your new test expects is a good addition to the system. I
would describe it as:
Subject: config: teach "git config --file -" to read from the standard input
I however think the patch implements it at the level that is too low
in the callchain. It will affect a lot more than the dash given to
"git config --file -". Fortunately, it does not make it possible
for users to make this mistake
[include]
path = -
and scratch their heads, wondering why "git config" is not answering
until they hit ^D. But that is _only_ because we check if a file
whose name is "-" actually exists in the current directory before
falling into this codepath (and usually no such file exists). If
such a funnily-named file does exist, we read from that file, not
the standard input. So that "include" codepath happens to be safe,
but who knows what dragons lie in other codepaths that call this
function.
I recall that an earlier implementation of "git diff --no-index"
that made "-" read one side to be compared from the standard input
had exactly the same issue of comparing filename with "-", which we
had to fix with code reorganization recently. I'd prefer to see
this update to "git config --file -" done the right way from the
start.
> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
> index 967359344dab..f1a63075e34f 100755
> --- a/t/t1300-repo-config.sh
> +++ b/t/t1300-repo-config.sh
> @@ -484,6 +484,10 @@ test_expect_success 'alternative GIT_CONFIG (--file)' '
> test_cmp expect output
> '
>
> +test_expect_success 'alternative GIT_CONFIG (--file=-)' '
> + git config --file - -l < other-config > output &&
Please leave no SP between redirection operator and its file, i.e.
git config --file - --list <other-config >output
Thanks.
next prev parent reply other threads:[~2014-02-14 18:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 13:34 [PATCH] config: git_config_from_file(): handle "-" filename as stdin Kirill A. Shutemov
2014-02-14 18:27 ` Junio C Hamano [this message]
2014-02-14 20:04 ` Kirill A. Shutemov
2014-02-14 20:35 ` 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=xmqqlhxdim80.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.