git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Glen Choo" <chooglen@google.com>,
	"Atharva Raykar" <raykar.ath@gmail.com>,
	"Prathamesh Chavan" <pc44800@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v3 28/32] submodule--helper: libify "must_die_on_failure" code paths (for die)
Date: Sun, 21 Aug 2022 15:57:37 +0200	[thread overview]
Message-ID: <patch-v3-28.32-6d9bccb34c3-20220821T130231Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v3-00.32-00000000000-20220821T130231Z-avarab@gmail.com>

Continue the libification of codepaths that previously relied on
"must_die_on_failure". In these cases we've always been early aborting
by calling die(), but as we know that these codpaths will properly
handle return codes of 128 to mean an early abort let's have them use
die_message() instead.

This still isn't a complete migration away from die() for these
codepaths, in particular this code in update_submodule() will still call die() in some cases:

	char *remote_name = get_default_remote_submodule(update_data->sm_path);
	const char *branch = remote_submodule_branch(update_data->sm_path);

But as that code is used by other callers than the "update" code let's
leave converting it for a subsequent commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/submodule--helper.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 851000ae30e..5f109d422ea 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2245,9 +2245,9 @@ static int run_update_procedure(struct update_data *ud)
 		 */
 		if (!is_tip_reachable(ud->sm_path, &ud->oid) &&
 		    fetch_in_submodule(ud->sm_path, ud->depth, ud->quiet, &ud->oid))
-			die(_("Fetched in submodule path '%s', but it did not "
-			      "contain %s. Direct fetching of that commit failed."),
-			    ud->displaypath, oid_to_hex(&ud->oid));
+			return die_message(_("Fetched in submodule path '%s', but it did not "
+					     "contain %s. Direct fetching of that commit failed."),
+					   ud->displaypath, oid_to_hex(&ud->oid));
 	}
 
 	return run_update_command(ud, subforce);
@@ -2291,13 +2291,14 @@ static const char *remote_submodule_branch(const char *path)
 	return branch;
 }
 
-static void ensure_core_worktree(const char *path)
+static int ensure_core_worktree(const char *path)
 {
 	const char *cw;
 	struct repository subrepo;
 
 	if (repo_submodule_init(&subrepo, the_repository, path, null_oid()))
-		die(_("could not get a repository handle for submodule '%s'"), path);
+		return die_message(_("could not get a repository handle for submodule '%s'"),
+				   path);
 
 	if (!repo_config_get_string_tmp(&subrepo, "core.worktree", &cw)) {
 		char *cfg_file, *abs_path;
@@ -2315,6 +2316,8 @@ static void ensure_core_worktree(const char *path)
 		free(abs_path);
 		strbuf_release(&sb);
 	}
+
+	return 0;
 }
 
 static const char *submodule_update_type_to_label(enum submodule_update_type type)
@@ -2390,7 +2393,9 @@ static int update_submodule(struct update_data *update_data)
 {
 	int ret;
 
-	ensure_core_worktree(update_data->sm_path);
+	ret = ensure_core_worktree(update_data->sm_path);
+	if (ret)
+		return ret;
 
 	update_data->displaypath = get_submodule_displaypath(
 		update_data->sm_path, update_data->prefix);
@@ -2406,8 +2411,8 @@ static int update_submodule(struct update_data *update_data)
 	if (update_data->just_cloned)
 		oidcpy(&update_data->suboid, null_oid());
 	else if (resolve_gitlink_ref(update_data->sm_path, "HEAD", &update_data->suboid))
-		die(_("Unable to find current revision in submodule path '%s'"),
-			update_data->displaypath);
+		return die_message(_("Unable to find current revision in submodule path '%s'"),
+				   update_data->displaypath);
 
 	if (update_data->remote) {
 		char *remote_name = get_default_remote_submodule(update_data->sm_path);
@@ -2417,13 +2422,13 @@ static int update_submodule(struct update_data *update_data)
 		if (!update_data->nofetch) {
 			if (fetch_in_submodule(update_data->sm_path, update_data->depth,
 					      0, NULL))
-				die(_("Unable to fetch in submodule path '%s'"),
-				    update_data->sm_path);
+				return die_message(_("Unable to fetch in submodule path '%s'"),
+						   update_data->sm_path);
 		}
 
 		if (resolve_gitlink_ref(update_data->sm_path, remote_ref, &update_data->oid))
-			die(_("Unable to find %s revision in submodule path '%s'"),
-			    remote_ref, update_data->sm_path);
+			return die_message(_("Unable to find %s revision in submodule path '%s'"),
+					   remote_ref, update_data->sm_path);
 
 		free(remote_ref);
 	}
-- 
2.37.2.1279.g64dec4e13cf


  parent reply	other threads:[~2022-08-21 14:00 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 16:16 [PATCH 00/20] submodule--helper: add tests, rm dead code, refactor & leak prep Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 01/20] submodule tests: test usage behavior Ævar Arnfjörð Bjarmason
2022-07-29 20:30   ` Glen Choo
2022-07-28 16:16 ` [PATCH 02/20] submodule tests: test for "add <repository> <abs-path>" Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 03/20] submodule--helper: remove unused "name" helper Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 04/20] submodule--helper: remove unused "list" helper Ævar Arnfjörð Bjarmason
2022-07-29 21:31   ` Glen Choo
2022-07-28 16:16 ` [PATCH 05/20] test-tool submodule-config: remove unused "--url" handling Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 06/20] submodule--helper: move "is-active" to a test-tool Ævar Arnfjörð Bjarmason
2022-07-29 21:45   ` Glen Choo
2022-07-28 16:16 ` [PATCH 07/20] submodule--helper: move "check-name" " Ævar Arnfjörð Bjarmason
2022-07-29 21:55   ` Glen Choo
2022-07-28 16:16 ` [PATCH 08/20] submodule--helper: move "resolve-relative-url-test" " Ævar Arnfjörð Bjarmason
2022-07-29 21:58   ` Glen Choo
2022-07-28 16:16 ` [PATCH 09/20] submodule--helper style: don't separate declared variables with \n\n Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 10/20] submodule--helper style: add \n\n after variable declarations Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 11/20] submodule--helper: replace memset() with { 0 }-initialization Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 12/20] submodule--helper: convert a strbuf_detach() to xstrfmt() Ævar Arnfjörð Bjarmason
2022-07-28 16:16 ` [PATCH 13/20] submodule--helper: stop conflating "sb" in clone_submodule() Ævar Arnfjörð Bjarmason
2022-07-29 17:08   ` Glen Choo
2022-07-28 16:16 ` [PATCH 14/20] submodule--helper: pass a "const struct module_clone_data" to clone_submodule() Ævar Arnfjörð Bjarmason
2022-07-29 22:09   ` Glen Choo
2022-08-01 15:05     ` Ævar Arnfjörð Bjarmason
2022-07-28 16:17 ` [PATCH 15/20] submodule--helper: add "const" to copy of "update_data" Ævar Arnfjörð Bjarmason
2022-07-28 16:17 ` [PATCH 16/20] submodule--helper: refactor "errmsg_str" to be a "struct strbuf" Ævar Arnfjörð Bjarmason
2022-07-28 16:17 ` [PATCH 17/20] submodule--helper: rename "int res" to "int ret" Ævar Arnfjörð Bjarmason
2022-07-28 16:17 ` [PATCH 18/20] submodule--helper: add skeleton "goto cleanup" to update_submodule() Ævar Arnfjörð Bjarmason
2022-07-28 16:17 ` [PATCH 19/20] submodule--helper: don't exit() on failure, return Ævar Arnfjörð Bjarmason
2022-07-29 22:23   ` Glen Choo
2022-07-28 16:17 ` [PATCH 20/20] submodule--helper: fix bad config API usage Ævar Arnfjörð Bjarmason
2022-07-29 22:52 ` [PATCH 00/20] submodule--helper: add tests, rm dead code, refactor & leak prep Glen Choo
2022-08-02 15:45 ` [PATCH v2 00/28] " Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 01/28] submodule tests: test usage behavior Ævar Arnfjörð Bjarmason
2022-08-02 22:30     ` Glen Choo
2022-08-02 15:45   ` [PATCH v2 02/28] submodule tests: test for "add <repository> <abs-path>" Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 03/28] submodule--helper: remove unused "name" helper Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 04/28] submodule--helper: remove unused "list" helper Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 05/28] test-tool submodule-config: remove unused "--url" handling Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 06/28] submodule--helper: move "is-active" to a test-tool Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 07/28] submodule--helper: move "check-name" " Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 08/28] submodule--helper: move "resolve-relative-url-test" " Ævar Arnfjörð Bjarmason
2022-08-02 22:32     ` Glen Choo
2022-08-02 15:45   ` [PATCH v2 09/28] submodule--helper style: don't separate declared variables with \n\n Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 10/28] submodule--helper style: add \n\n after variable declarations Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 11/28] submodule--helper: replace memset() with { 0 }-initialization Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 12/28] submodule--helper: use xstrfmt() in clone_submodule() Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 13/28] submodule--helper: move "sb" in clone_submodule() to its own scope Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 14/28] submodule--helper: pass a "const struct module_clone_data" to clone_submodule() Ævar Arnfjörð Bjarmason
2022-08-02 15:45   ` [PATCH v2 15/28] submodule--helper: add "const" to copy of "update_data" Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 16/28] submodule--helper: refactor "errmsg_str" to be a "struct strbuf" Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 17/28] submodule--helper: don't redundantly check "else if (res)" Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 18/28] submodule--helper: rename "int res" to "int ret" Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 19/28] submodule--helper: return "ret", not "1" from update_submodule() Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 20/28] submodule--helper: add missing braces to "else" arm Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 21/28] submodule--helper: don't call submodule_strategy_to_string() in BUG() Ævar Arnfjörð Bjarmason
2022-08-02 23:08     ` Glen Choo
2022-08-02 15:46   ` [PATCH v2 22/28] submodule--helper: move submodule_strategy_to_string() to only user Ævar Arnfjörð Bjarmason
2022-08-02 23:30     ` Glen Choo
2022-08-03 13:06       ` Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 23/28] submodule--helper: use "code" in run_update_command() Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 24/28] submodule--helper: don't exit() on failure, return Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 25/28] submodule--helper: libify determine_submodule_update_strategy() Ævar Arnfjörð Bjarmason
2022-08-02 15:46   ` [PATCH v2 26/28] submodule--helper: libify "must_die_on_failure" code paths Ævar Arnfjörð Bjarmason
2022-08-03  4:37     ` Glen Choo
2022-08-02 15:46   ` [PATCH v2 27/28] submodule--helper: libify "must_die_on_failure" code paths (for die) Ævar Arnfjörð Bjarmason
2022-08-03  4:32     ` Glen Choo
2022-08-02 15:46   ` [PATCH v2 28/28] submodule--helper: fix bad config API usage Ævar Arnfjörð Bjarmason
2022-08-21 13:57 ` [PATCH v3 00/32] submodule--helper: add tests, rm dead code, refactor & leak prep Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 01/32] submodule tests: test usage behavior Ævar Arnfjörð Bjarmason
2022-08-23 22:42     ` Glen Choo
2022-08-21 13:57   ` [PATCH v3 02/32] submodule tests: test for "add <repository> <abs-path>" Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 03/32] submodule--helper: remove unused "name" helper Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 04/32] submodule--helper: remove unused "list" helper Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 05/32] test-tool submodule-config: remove unused "--url" handling Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 06/32] submodule--helper: move "is-active" to a test-tool Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 07/32] submodule--helper: move "check-name" " Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 08/32] submodule--helper: move "resolve-relative-url-test" " Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 09/32] submodule--helper style: don't separate declared variables with \n\n Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 10/32] submodule--helper style: add \n\n after variable declarations Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 11/32] submodule--helper: replace memset() with { 0 }-initialization Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 12/32] submodule--helper: use xstrfmt() in clone_submodule() Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 13/32] submodule--helper: move "sb" in clone_submodule() to its own scope Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 14/32] submodule--helper: add "const" to passed "module_clone_data" Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 15/32] submodule--helper: add "const" to copy of "update_data" Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 16/32] submodule--helper: refactor "errmsg_str" to be a "struct strbuf" Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 17/32] submodule--helper: don't redundantly check "else if (res)" Ævar Arnfjörð Bjarmason
2022-08-21 16:12     ` Eric Sunshine
2022-08-21 13:57   ` [PATCH v3 18/32] submodule--helper: rename "int res" to "int ret" Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 19/32] submodule--helper: return "ret", not "1" from update_submodule() Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 20/32] submodule--helper: add missing braces to "else" arm Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 21/32] submodule--helper: don't call submodule_strategy_to_string() in BUG() Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 22/32] submodule API: don't handle SM_..{UNSPECIFIED,COMMAND} in to_string() Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 23/32] submodule--helper: use "code" in run_update_command() Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 24/32] submodule--helper: don't exit() on failure, return Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 25/32] submodule--helper: libify determine_submodule_update_strategy() Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 26/32] submodule--helper: libify "must_die_on_failure" code paths Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` [PATCH v3 27/32] submodule--helper update: don't override 'checkout' exit code Ævar Arnfjörð Bjarmason
2022-08-21 13:57   ` Ævar Arnfjörð Bjarmason [this message]
2022-08-23 23:27     ` [PATCH v3 28/32] submodule--helper: libify "must_die_on_failure" code paths (for die) Glen Choo
2022-08-21 13:57   ` [PATCH v3 29/32] submodule--helper: check repo{_submodule,}_init() return values Ævar Arnfjörð Bjarmason
2022-08-23 23:38     ` Glen Choo
2022-08-21 13:57   ` [PATCH v3 30/32] submodule--helper: libify more "die" paths for module_update() Ævar Arnfjörð Bjarmason
2022-08-24  0:07     ` Glen Choo
2022-08-21 13:57   ` [PATCH v3 31/32] submodule--helper: libify even " Ævar Arnfjörð Bjarmason
2022-08-24  0:12     ` Glen Choo
2022-08-21 13:57   ` [PATCH v3 32/32] submodule--helper: fix bad config API usage Ævar Arnfjörð Bjarmason
2022-08-31 23:17   ` [PATCH v4 00/33] submodule--helper: add tests, rm dead code, refactor & leak prep Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 01/33] submodule tests: test usage behavior Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 02/33] submodule tests: test for "add <repository> <abs-path>" Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 03/33] submodule--helper: remove unused "name" helper Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 04/33] submodule--helper: remove unused "list" helper Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 05/33] test-tool submodule-config: remove unused "--url" handling Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 06/33] submodule--helper: move "is-active" to a test-tool Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 07/33] submodule--helper: move "check-name" " Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 08/33] submodule--helper: move "resolve-relative-url-test" " Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 09/33] submodule--helper style: don't separate declared variables with \n\n Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 10/33] submodule--helper style: add \n\n after variable declarations Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 11/33] submodule--helper: replace memset() with { 0 }-initialization Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 12/33] submodule--helper: use xstrfmt() in clone_submodule() Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 13/33] submodule--helper: move "sb" in clone_submodule() to its own scope Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 14/33] submodule--helper: add "const" to passed "module_clone_data" Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 15/33] submodule--helper: add "const" to copy of "update_data" Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 16/33] submodule--helper: add "const" to passed "struct update_data" Ævar Arnfjörð Bjarmason
2022-08-31 23:17     ` [PATCH v4 17/33] submodule--helper: refactor "errmsg_str" to be a "struct strbuf" Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 18/33] submodule--helper: don't redundantly check "else if (res)" Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 19/33] submodule--helper: rename "int res" to "int ret" Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 20/33] submodule--helper: return "ret", not "1" from update_submodule() Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 21/33] submodule--helper: add missing braces to "else" arm Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 22/33] submodule--helper: don't call submodule_strategy_to_string() in BUG() Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 23/33] submodule API: don't handle SM_..{UNSPECIFIED,COMMAND} in to_string() Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 24/33] submodule--helper: use "code" in run_update_command() Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 25/33] submodule--helper: don't exit() on failure, return Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 26/33] submodule--helper: libify determine_submodule_update_strategy() Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 27/33] submodule--helper: libify "must_die_on_failure" code paths Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 28/33] submodule--helper update: don't override 'checkout' exit code Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 29/33] submodule--helper: libify "must_die_on_failure" code paths (for die) Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 30/33] submodule--helper: check repo{_submodule,}_init() return values Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 31/33] submodule--helper: libify more "die" paths for module_update() Ævar Arnfjörð Bjarmason
2022-09-01 20:55       ` Glen Choo
2022-08-31 23:18     ` [PATCH v4 32/33] submodule--helper: libify even " Ævar Arnfjörð Bjarmason
2022-08-31 23:18     ` [PATCH v4 33/33] submodule--helper: fix bad config API usage Ævar Arnfjörð Bjarmason
2022-09-01 20:59     ` [PATCH v4 00/33] submodule--helper: add tests, rm dead code, refactor & leak prep Glen Choo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-v3-28.32-6d9bccb34c3-20220821T130231Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=chooglen@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pc44800@gmail.com \
    --cc=raykar.ath@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).