Re: [PATCH 2/2] gitcredentials(7): make shell-snippet example more realistic
- From
Jeff King <peff@peff.net>
- Date
- May 1, 2020, 07:32 UTC
- Message-ID
- <20200501073222.GB27392@coredump.intra.peff.net>
- In-Reply-To
- <20200501063513.GB26128@coredump.intra.peff.net>
On Fri, May 01, 2020 at 02:35:13AM -0400, Jeff King wrote:
Show 28 quoted lines
> On Fri, May 01, 2020 at 02:32:07AM -0400, Jeff King wrote:
>
> > > All of them make sense, but I do not think we want to encourage that
> > > loose style of passing unquoted argument to echo to lose embedded
> > > $IFS spaces that is not a SP.
> >
> > You mean dropping the quotes in the first patch?
> >
> > Doing:
> >
> > echo "password=$(cat $HOME/.secret)"
> >
> > already eats some trailing whitespace, though I guess if you have
> > newlines in your password you are beyond help anyway.
> >
> > I can add back in the quoted \", though it does make the code slightly
> > harder to read.
>
> Or did you mean passing $1 in the test call? It definitely isn't good
> shell practice, but we know that we're getting a single-word action from
> Git, per the protocol.
>
> Fully quoting, it looks like this:
>
> helper = "!f() { test \"$1\" = get && echo \"password=$(cat $HOME/.secret)\"; }; f"
>
> which IMHO is getting a little hard to read. I think that's part of why
> I gave such an unfinished example in the first place. :)So I dunno. That's ugly, but I don't think is worth nitpicking over more. So here it is with indentation and full-on quoting.
[1/2]: gitcredentials(7): clarify quoting of helper examples [2/2]: gitcredentials(7): make shell-snippet example more realistic
Documentation/gitcredentials.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
-Peff