Re: [PATCH] doc: fix quoting bug in credential cache example
From: Junio C Hamano <hidden>
Date: 2020-05-01 06:20:59
Jeff King [off-list ref] writes:
quoted hunk
I think we can either clarify that with a note at the beginning of the list, or we can just present it as config, like:diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt index 1814d2d23c..c756ecb8fd 100644 --- a/Documentation/gitcredentials.txt +++ b/Documentation/gitcredentials.txt@@ -216,20 +216,25 @@ Here are some example specifications: ---------------------------------------------------- # run "git credential-foo" -foo +[credential] +helper = foo
I like this style of "clarification"; it makes it clear that we are explaining the value in the config-file syntax.
# or you can specify your own shell snippet
-!f() { echo "password=`cat $HOME/.secret`"; }; f
+[credential]
+helper = "!f() { echo \"password=`cat $HOME/.secret`\"; }; f"
But I do not think the "tentative shell function" trick is
necessary. I personally think it is oversold ;-) For this
particular one,
[credential]
helper = !echo \"password=`cat $HOME/.secret`\"
should be sufficient, perhaps? You do not even need to understand
how shell functions work to understand it.
Also, "git config" indents the "var = value" lines, so it would look
more natural if we indented our examples in a similar way.
Thanks.