Refactor: break up nested ternaries into multiple lines#1158
Refactor: break up nested ternaries into multiple lines#1158krobelus wants to merge 1 commit intojonas:masterfrom
Conversation
We have some places where multiple ternary operators are nested on a single line. Break them up into multiple lines. I think this is much easier to read because the indentation shows the nesting structure. No functional change here. Reading through format_append_arg(), I noticed that "echo %%(commit" with the missing closing parenthesis is not supported. Probably not worth spending too much time on that.
|
Not much time needed, I think this should do the job: - if (var && !closing)
+ if (var && !closing && !esc)When doing 6134336, I took it as a challenge to do it in one line only, so I'll have hard time to let it go :-), but, agreed, as we have no plans to enter IOCCC with Tig, we should prioritize the readability. |
Problem is that
Haha yeah, I was mildly surprised when I came across this while trying to understand the formatting logic |
|
You're right, I missed that point. This is better but as you said, we cannot get - if (var && !closing)
- return false;
+ if (var && !closing) {
+ if (!esc)
+ return false;
+ else
+ ++arg;
+ } |
|
Ideally we can interpret each |
We have some places where multiple ternary operators are nested on a
single line. Break them up into multiple lines. I think this is much
easier to read because the indentation shows the nesting structure.
No functional change here.
Reading through format_append_arg(), I noticed that "echo %%(commit"
with the missing closing parenthesis is not supported. Probably
not worth spending too much time on that.