From 1cc2c772dd4dc5f9396a229e2727ca28ef25c33b Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 13 Sep 2014 16:16:53 -0400 Subject: prune-packed: fix minor memory leak We form all of our directories in a strbuf, but never release it. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/prune-packed.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin') diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index 6879468c46..d430731d70 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -68,6 +68,7 @@ void prune_packed_objects(int opts) rmdir(pathname.buf); } stop_progress(&progress); + strbuf_release(&pathname); } int cmd_prune_packed(int argc, const char **argv, const char *prefix) -- cgit v1.2.3 From 4489a480fdfe53e1ca78eabdab2dee00376814a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 13 Sep 2014 09:28:01 +0200 Subject: repack: call prune_packed_objects() and update_server_info() directly Call the functions behind git prune-packed and git update-server-info directly instead of using run_command(). This is shorter, easier and quicker. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin/repack.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'builtin') diff --git a/builtin/repack.c b/builtin/repack.c index a77e743b94..6912831273 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -378,6 +378,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix) /* End of pack replacement. */ if (delete_redundant) { + int opts = 0; sort_string_list(&names); for_each_string_list_item(item, &existing_packs) { char *sha1; @@ -388,25 +389,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix) if (!string_list_has_string(&names, sha1)) remove_redundant_pack(packdir, item->string); } - argv_array_push(&cmd_args, "prune-packed"); - if (quiet) - argv_array_push(&cmd_args, "--quiet"); - - memset(&cmd, 0, sizeof(cmd)); - cmd.argv = cmd_args.argv; - cmd.git_cmd = 1; - run_command(&cmd); - argv_array_clear(&cmd_args); + if (!quiet && isatty(2)) + opts |= PRUNE_PACKED_VERBOSE; + prune_packed_objects(opts); } - if (!no_update_server_info) { - argv_array_push(&cmd_args, "update-server-info"); - memset(&cmd, 0, sizeof(cmd)); - cmd.argv = cmd_args.argv; - cmd.git_cmd = 1; - run_command(&cmd); - argv_array_clear(&cmd_args); - } + if (!no_update_server_info) + update_server_info(0); remove_temporary_files(); string_list_clear(&names, 0); string_list_clear(&rollback, 0); -- cgit v1.2.3