Denton Liu <liu.denton@xxxxxxxxx> writes: >> > 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, > >> 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).