Closed nkouevda closed 1 year ago
I didn't expect this to work, given what I wrote here about the error handler being triggered, but it does indeed work – nice! It turns out the output on stderr from the failing git-show
comes before the diff output on stdout, so although the error callback is triggered it doesn't matter because the success callback is triggered afterwards.
My only concern is ;
. It works fine for me on macOS. But according to this Windows command shell overview on Windows the semi-colon is used differently, to separate parameters. It looks like the correct character is &
. However that would (probably?) need escaping, which is a pandora's box.
So I'd really like to merge this but I can't unless I can be sure it won't break on Windows.
However that would (probably?) need escaping...
Having said that, the existing &&
and ||
and >
in the command aren't escaped so maybe it's ok. Do you have any way to try it on Windows?
Rebased and updated with a different approach: adding another || exit 0
.
So instead of:
cd ... && (git show ... && git diff ... | grep ... || exit 0)
It would now be:
cd ... && (git show ... || exit 0) && (git diff ... | grep ... || exit 0)
Do you have any way to try it on Windows?
I do not.
Thanks, this is much neater than my original solution.
Instead of checking whether this file exists in
diff_base
and returning early, we letgit show
fail, which still creates an emptyfrom_file
for the subsequentgit diff
to use.This mostly reverts 2ee95686c5944f99b42dd04fec005b30497006de, but we keep the test case.
For posterity: this was originally meant to fix #869, but #870 accomplished that.