Thread (1 message) 1 message, 1 author, 2019-03-18

Re: [PATCH v8 00/11] Fix scissors bug during conflict

From: Junio C Hamano <hidden>
Date: 2019-03-18 08:25:12

Denton Liu [off-list ref] writes:
quoted
quoted
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.
You mentioned in an earlier email that,
quoted
The intermediary file may want a name better than 'tmp', if it is to
be left behind, but this will do for now.
so I wrote it in a way temporary files wouldn't be produced, similar to
how 'set up mod-256 conflict scenario' in t7600 does it.
I didn't mean to say that the name of the final file should be
garbage, though ;-) I was hinting, by mentioning "if it is to be
left behind", to remove it when you are done with the temporary.

If we were to give more meaningful name, then perhaps just get rid
of the name "tmp", like so.

	echo what is expected >expect &&
	git testing-output-from-this-command ... >output.raw &&
	sed-or-something-to-extract-what-matters output.raw >actual &&
	test_cmp expect actual

which is also good (and when the test fails, looking at the trash
directory and finding the raw output named *.raw may be easier from
the output of "ls trash*" while debugging).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help