Re: [PATCH v8 00/11] Fix scissors bug during conflict
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 18, 2019, 06:35 UTC
- Message-ID
- <xmqqa7hs3d0z.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190317130539.GA23160@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 13 quoted lines
>> + git commit ${3+"$3"} -m "$2" >act &&
>> + head -1 <act >tmp &&
>> + mv tmp act &&
>
> Here you could swap the order of when you write to 'act' and 'tmp',
> and thus make the 'mv' unnecessary, like this:
>
> git commit [...] >tmp &&
> head -1 act >tmp &&
> [...rest of the test...]
>
> Note also that 'head' (or 'sed' in later tests) can open its input
> file on its own, there's no need to redirect its standard input.Yup, that is better with a slight fix
git testing-output-from-this-command ... >tmp && head -n 1 tmp >actual &&
to actually read from the output kept in the temporary file.
Especially I think bare -<num> is a BSDism that has been removed from POSIX some time ago.