Thread (6 messages) 6 messages, 2 authors, 2020-05-01

Re: [PATCH 2/2] gitcredentials(7): make shell-snippet example more realistic

From: Jeff King <hidden>
Date: 2020-05-01 06:35:15

Possibly related (same subject, not in this thread)

On Fri, May 01, 2020 at 02:32:07AM -0400, Jeff King wrote:
quoted
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. :)

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help