summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-26 21:39:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-26 21:39:44 (GMT)
commitc0f5f311dbb219c88a2da4a3029f9c7d9c554753 (patch)
treecb17d6278ad6e51d84691d3e38658d14c71229fc /builtin
parentf190737f225638addbc6695ef27eb926f31bd4e4 (diff)
parent4489a480fdfe53e1ca78eabdab2dee00376814a3 (diff)
downloadgit-c0f5f311dbb219c88a2da4a3029f9c7d9c554753.zip
git-c0f5f311dbb219c88a2da4a3029f9c7d9c554753.tar.gz
git-c0f5f311dbb219c88a2da4a3029f9c7d9c554753.tar.bz2
Merge branch 'jk/prune-packed-server-info'
Code cleanup. * jk/prune-packed-server-info: repack: call prune_packed_objects() and update_server_info() directly server-info: clean up after writing info/packs make update-server-info more robust prune-packed: fix minor memory leak
Diffstat (limited to 'builtin')
-rw-r--r--builtin/prune-packed.c1
-rw-r--r--builtin/repack.c23
2 files changed, 7 insertions, 17 deletions
diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c
index 6879468..d430731 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)
diff --git a/builtin/repack.c b/builtin/repack.c
index fc088db..2aae05d 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -377,6 +377,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;
@@ -387,25 +388,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);