aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-04-13 22:01:40 +0200
committerJunio C Hamano <gitster@pobox.com>2022-04-13 23:56:09 -0700
commit0139c58ab951e8620d6066eb687d0a96e490436a (patch)
treebdf014371e9a7407c94c695e1d224eea4eda8d66 /builtin/submodule--helper.c
parent5e480176fed01aeb47735f525002203ac6e462d0 (diff)
downloadgit-0139c58ab951e8620d6066eb687d0a96e490436a.tar.gz
revisions API users: add "goto cleanup" for release_revisions()
Add a release_revisions() to various users of "struct rev_info" which requires a minor refactoring to a "goto cleanup" pattern to use that function. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index cda33ee4d2..1bd31c8594 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1232,6 +1232,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
struct strvec diff_args = STRVEC_INIT;
struct rev_info rev;
struct module_cb_list list = MODULE_CB_LIST_INIT;
+ int ret = 0;
strvec_push(&diff_args, get_diff_cmd(diff_cmd));
if (info->cached)
@@ -1257,11 +1258,13 @@ static int compute_summary_module_list(struct object_id *head_oid,
setup_work_tree();
if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
perror("read_cache_preload");
- return -1;
+ ret = -1;
+ goto cleanup;
}
} else if (read_cache() < 0) {
perror("read_cache");
- return -1;
+ ret = -1;
+ goto cleanup;
}
if (diff_cmd == DIFF_INDEX)
@@ -1269,9 +1272,10 @@ static int compute_summary_module_list(struct object_id *head_oid,
else
run_diff_files(&rev, 0);
prepare_submodule_summary(info, &list);
+cleanup:
strvec_clear(&diff_args);
release_revisions(&rev);
- return 0;
+ return ret;
}
static int module_summary(int argc, const char **argv, const char *prefix)