Skip to contentSkip to conversation

sequencer: remove todo_add_branch_context.commit

PATCH In review Abhinav Gupta via GitGitGadget 2 participants 2 messages May 11 – May 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sequencer: remove todo_add_branch_context.commit

From: Abhinav Gupta <[email protected]>

The 'commit' field in 'struct todo_add_branch_context' is unused. It's written to, but never read from. add_decorations_to_list() gets the commit passed to it explicitly as an argument.

---
sequencer: remove todo_add_branch_context.commit

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2111%2Fabhinav%2Fsequencer-todoctx-rm-commit-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2111/abhinav/sequencer-todoctx-rm-commit-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2111

 sequencer.c | 2 --
 1 file changed, 2 deletions(-)
sequencer.c +0 -2
index b7d8dca47f..19839da1e6 100644
@@ -6409,7 +6409,6 @@ struct todo_add_branch_context {
 	size_t items_nr;
 	size_t items_alloc;
 	struct strbuf *buf;
-	struct commit *commit;
 	struct string_list refs_to_oids;
 };
 
@@ -6498,7 +6497,6 @@ static int todo_list_add_update_ref_commands(struct todo_list *todo_list)
 		ctx.items[ctx.items_nr++] = todo_list->items[i++];
 
 		if (item->commit) {
-			ctx.commit = item->commit;
 			add_decorations_to_list(item->commit, &ctx);
 		}
 	}

base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 6 lines · Abhinav Gupta via GitGitGadget

From: Abhinav Gupta <[email protected]>

The 'commit' field in 'struct todo_add_branch_context' is unused. It's written to, but never read from. add_decorations_to_list() gets the commit passed to it explicitly as an argument.

To add some historic flavor: the struct has been introduced via 900b50c242 (rebase: add --update-refs option, 2022-07-19), and the commit field was already unused back then.

Quoted 13 lines
sequencer.c +0 -1
index b7d8dca47f..19839da1e6 100644
@@ -6409,7 +6409,6 @@ struct todo_add_branch_context {
 	size_t items_nr;
 	size_t items_alloc;
 	struct strbuf *buf;
-	struct commit *commit;
 	struct string_list refs_to_oids;
 };
 

sequencer.c static int todo_list_add_update_ref_commands(struct todo_list *todo_list) · line 6501

Quoted 6 lines
sequencer.c +0 -1
@@ -6498,7 +6497,6 @@ static int todo_list_add_update_ref_commands(struct todo_list *todo_list)
 		ctx.items[ctx.items_nr++] = todo_list->items[i++];
 
 		if (item->commit) {
-			ctx.commit = item->commit;
 			add_decorations_to_list(item->commit, &ctx);
 		}

Nit: while at it we could've also dropped the curly braces according to our coding guidelines. But that alone isn't worth a reroll.

Other than that this is a welcome cleanup, thanks!

Patrick