Re: [PATCH] contrib/subtree: unwrap tag refs
- From
Jeff King <peff@peff.net>
- Date
- Nov 13, 2015, 05:01 UTC
- Message-ID
- <20151113050123.GA29708@sigill.intra.peff.net>
- In-Reply-To
- <87h9kqwm67.fsf@waller.obbligato.org>
On Thu, Nov 12, 2015 at 10:36:16PM -0600, David A. Greene wrote:
Show 7 quoted lines
> > + sub="$(git rev-parse "$b^0")" || die "could not rev-parse split hash $b from commit $sq" > > This seems like odd quoting. Would not this do the same? > > sub="$(git rev-parse $b^0)" || die "could not rev-parse split hash $b from commit $sq" > > Perhaps I am missing something.
The former is quoting "$b" against whitespace splitting in the sub-command. Given that the value just came from a "read" call, I think by definition it cannot contains IFS. Still, quoting here is a good habit.
It is actually the _outer_ quotes that are unnecessary, as variable assignment does not do extra splitting. So:
foo=$(echo one two)
will put the full "one two" into $foo. But the quotes do not hurt anything, and it is a reasonable style to use them to avoid this discussion. :)
It also matches style-wise with nearby assignments, like:
main="$b"
-Peff