Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
repack: call prune_packed_objects() and update_server_info() directly
author
René Scharfe
<l.s.r@web.de>
Sat, 13 Sep 2014 07:28:01 +0000
(09:28 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 15 Sep 2014 18:39:58 +0000
(11:39 -0700)
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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3907a40
)
diff --git
a/builtin/repack.c
b/builtin/repack.c
index a77e743b94036b2d856e6b3f74999170e39b5f17..6912831273fc7222a1986eb54d0104fc8dfc33f7 100644
(file)
--- 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) {
/* End of pack replacement. */
if (delete_redundant) {
+ int opts = 0;
sort_string_list(&names);
for_each_string_list_item(item, &existing_packs) {
char *sha1;
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);
}
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);
remove_temporary_files();
string_list_clear(&names, 0);
string_list_clear(&rollback, 0);