branch: drop unused worktrees variable

After b489b9d9aa (branch: use branch_checked_out() when deleting refs, 2022-06-14), we no longer look at our local "worktrees" variable, since branch_checked_out() handles it under the hood. The compiler didn't notice the unused variable because we call functions to initialize and free it (so it's not totally unused, it just doesn't do anything useful). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 18, 2022 at 23:55 UTC 9bef0b1e6ec371e786c2fba3edcc06ad040a536c
1 file changed -4
builtin/branch.c
-4
@@ -204,7 +204,6 @@ static void delete_branch_config(const char *branchname)
204 static int delete_branches(int argc, const char **argv, int force, int kinds,
205 int quiet)
206 {
207 - struct worktree **worktrees;
207 struct commit *head_rev = NULL;
208 struct object_id oid;
209 char *name = NULL;
@@ -242,8 +241,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
241 die(_("Couldn't look up commit object for HEAD"));
242 }
243
245 - worktrees = get_worktrees();
246 -
244 for (i = 0; i < argc; i++, strbuf_reset(&bname)) {
245 char *target = NULL;
246 int flags = 0;
@@ -314,7 +311,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
311
312 free(name);
313 strbuf_release(&bname);
317 - free_worktrees(worktrees);
314
315 return ret;
316 }