git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] rebase: clarify conditionals in todo_list_to_strbuf()

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 2, 2023, 18:51 UTC
Message-ID
<64515bb97dd1b_1ba2d294f3@chronos.notmuch>
In-Reply-To
<20230428125601.1719750-1-oswald.buddenhagen@gmx.de>
Oswald Buddenhagen wrote:
Show 33 quoted lines
> Make it obvious that the two conditional branches are mutually
> exclusive. This makes it easier to comprehend and optimize.
> 
> As a drive-by, remove a pair of unnecessary braces.
> 
> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> ---
> v2:
> - slightly more verbose commit message
> ---
>  sequencer.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 3be23d7ca2..9169876441 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -5868,12 +5868,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
> -- 

FWIW makes total sense to me and does make the code easier to comprehend.

Reviewed-by: Felipe Contreras <felipe.contreras@gmail.com>
-- 
Felipe Contreras
Previous: Oswald BuddenhagenNext: Oswald Buddenhagen
Message 6 of 14 in “rebase: clarify conditionals in todo_list_to_strbuf()”
  1. rebase: clarify conditionals in todo_list_to_strbuf()Oswald Buddenhagen, Mar 23, 2023
  2. Taylor BlauMar 23, 2023
  3. Oswald BuddenhagenMar 24, 2023
  4. Phillip WoodMar 24, 2023
  5. rebase: clarify conditionals in todo_list_to_strbuf()Oswald Buddenhagen, Apr 28, 2023
  6. Felipe ContrerasMay 2, 2023
  7. rebase: clarify conditionals in todo_list_to_strbuf()Oswald Buddenhagen, Aug 7, 2023
  8. Junio C HamanoAug 7, 2023
  9. Oswald BuddenhagenAug 9, 2023
  10. Junio C HamanoAug 9, 2023
  11. Oswald BuddenhagenAug 10, 2023
  12. Junio C HamanoAug 10, 2023
  13. Oswald BuddenhagenAug 11, 2023
  14. Richard KerryAug 11, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.