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>
This commit is contained in:
committed by
Junio C Hamano
parent
5e480176fe
commit
0139c58ab9
@ -500,6 +500,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
int use_bitmap_index = 0;
|
||||
int filter_provided_objects = 0;
|
||||
const char *show_progress = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||
usage(rev_list_usage);
|
||||
@ -583,7 +584,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
if (!strcmp(arg, "--test-bitmap")) {
|
||||
test_bitmap_walk(&revs);
|
||||
return 0;
|
||||
goto cleanup;
|
||||
}
|
||||
if (skip_prefix(arg, "--progress=", &arg)) {
|
||||
show_progress = arg;
|
||||
@ -672,11 +673,11 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (use_bitmap_index) {
|
||||
if (!try_bitmap_count(&revs, filter_provided_objects))
|
||||
return 0;
|
||||
goto cleanup;
|
||||
if (!try_bitmap_disk_usage(&revs, filter_provided_objects))
|
||||
return 0;
|
||||
goto cleanup;
|
||||
if (!try_bitmap_traversal(&revs, filter_provided_objects))
|
||||
return 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (prepare_revision_walk(&revs))
|
||||
@ -696,8 +697,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
|
||||
find_bisection(&revs.commits, &reaches, &all, bisect_flags);
|
||||
|
||||
if (bisect_show_vars)
|
||||
return show_bisect_vars(&info, reaches, all);
|
||||
if (bisect_show_vars) {
|
||||
ret = show_bisect_vars(&info, reaches, all);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (filter_provided_objects) {
|
||||
@ -752,5 +755,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
if (show_disk_usage)
|
||||
printf("%"PRIuMAX"\n", (uintmax_t)total_disk_usage);
|
||||
|
||||
return 0;
|
||||
cleanup:
|
||||
release_revisions(&revs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user