On Mon, Apr 4, 2016 at 11:00 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote: > On Mon, Apr 4, 2016 at 8:45 AM, Pranit Bauva <pranit.bauva@xxxxxxxxx> wrote: >> Okay I will do the change. I was previously unaware about the use of >> '\' before EOF. I googled it now. But I am still confused about its >> use in this scenario. Upto what I understood, it is used where you >> want to expand a variable, substitute a command, arithmethic >> expansion. The use of '\' in the tests I have changed in v12 wrt 11 is >> understood by me as you want to remove the use of escape sequences >> which is justified. But this seems a bit vague. Is it some convention >> in git? > > Both 'EOF' and \EOF suppress interpolation and other transformations > in the heredoc content which would otherwise occur with plain EOF. The > 'EOF' form is well documented; \EOF not so much, but is used heavily > in git test scripts. So: > > x=flormp > echo <<EOF > Hello, $x > EOF > > prints "Hello, flormp", whereas: > > echo <<\EOF > Hello, $x > EOF > > prints "Hello, $x". > > While test scripts sometimes use \EOF to explicitly suppress variable > expansion, it's also quite common to use it even when there is nothing > which could be expanded in the heredoc content, in which case it > signals to the reader that the author doesn't expect the content to > undergo expansion or interpolation. It's also a bit of future-proofing > in case some later change to the heredoc content inserts something > which might otherwise be expanded. Thanks for taking out your time to explain this clearly. I will do the changes in the tests as suggested by your review. :) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html