[PATCH v3] rebase: clarify conditionals in todo_list_to_strbuf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make it obvious that the two conditional branches are mutually
exclusive. This makes it easier to comprehend and optimize, like a
switch statement would do, except that it would be overkill here.

As a drive-by, remove a pair of unnecessary braces.

Reviewed-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@xxxxxx>
---
v2 & v3:
- slightly more verbose commit message

Cc: Taylor Blau <me@xxxxxxxxxxxx>
Cc: Phillip Wood <phillip.wood123@xxxxxxxxx>
Cc: Junio C Hamano <gitster@xxxxxxxxx>
---
 sequencer.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index cc9821ece2..97801d0489 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -5880,12 +5880,9 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis
 			if (item->command == TODO_FIXUP) {
 				if (item->flags & TODO_EDIT_FIXUP_MSG)
 					strbuf_addstr(buf, " -c");
-				else if (item->flags & TODO_REPLACE_FIXUP_MSG) {
+				else if (item->flags & TODO_REPLACE_FIXUP_MSG)
 					strbuf_addstr(buf, " -C");
-				}
-			}
-
-			if (item->command == TODO_MERGE) {
+			} else if (item->command == TODO_MERGE) {
 				if (item->flags & TODO_EDIT_MERGE_MSG)
 					strbuf_addstr(buf, " -c");
 				else
-- 
2.40.0.152.g15d061e6df




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux