Re: [PATCH v3 2/2] Added tests for reset -
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 10, 2015, 18:05 UTC
- Message-ID
- <CAPig+cSqJcfNRXmLdHXvHvUiv1NFgXA6cZ4YFyxoWuyivjWUEQ@mail.gmail.com>
- In-Reply-To
- <CAODo60p_2deueOS5nYfHPTMas=GcHR4n8dNs8HJt-ZR+2SifzA@mail.gmail.com>
On Tue, Mar 10, 2015 at 1:52 PM, Sudhanshu Shekhar <sudshekhar02@gmail.com> wrote:
Show 19 quoted lines
> On Tue, Mar 10, 2015 at 6:56 PM, Matthieu Moy > <Matthieu.Moy@grenoble-inp.fr> wrote: >> Sudhanshu Shekhar <sudshekhar02@gmail.com> writes: >>> +test_expect_success 'reset - in the presence of file named - with previous branch' ' >>> + echo "Unstaged changes after reset:" >expect && >>> + echo "M -" >>expect && >>> + echo "M 1" >>expect && >> >> Here and elsewhere: why not >> >> cat >expect <<-EOF >> Unstaged changes after reset: >> M - >> M 1 >> >> ? > I was confused whether to use cat or echo. I thought using cat will > disrupt the indentation as the EOF needs to be on a single line. This > is why I chose echo. Please let me know your thoughts on this.
Here-docs are easier to compose and read than individual 'echo' statements for multi-line content.
The '-' in front of EOF allows you to indent the entire body. Even better, use -\EOF to signify that you don't expect any interpolation to occur within the body.