3 ms·
I'm thinking they mean the Bourne(-style) shell, where this syntax means that test is run, either commit or revert is run. That is, it is a shorthand for: if
by adrianmonk 8y ago
I'm thinking they mean the Bourne(-style) shell, where this syntax means that test is run, either commit or revert is run. That is, it is a shorthand for:
if test
then
commit
else
revert
fi
Presumably the point is to encourage you to keep your code changes and tests so small that you are OK with losing work.
- mikelward 8y agoIt's actually equivalent to if test; then commit || revert else revert fi Or in another language: try { test commit } catch { revert } This is because test && commit is evaluated, and the resulting value is the left side of expr || revert Not sure if that was intentional, but it's a very nice one liner assuming either your commit never fails, or your commit runs extra tests, and you want to revert if those fail.