{"thread":{"id":"45812","subject":"[PATCH] repack: accept --threads=<n> and pass it down to pack-objects","startedAt":"2017-04-27T00:08:48Z","lastAt":"2017-04-27T03:20:44Z","messageCount":2,"participants":["Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"318015","messageId":"xmqqr30er9tk.fsf@gitster.mtv.corp.google.com","threadId":"45812","inReplyTo":null,"subject":"[PATCH] repack: accept --threads=<n> and pass it down to pack-objects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-04-27T00:08:39Z","receivedAt":"2017-04-27T00:08:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We already do so for --window=<n> and --depth=<n>; this will help\nwhen the user wants to force --threads=1 for reproducible testing\nwithout getting affected by racing multiple threads.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-repack.txt | 5 ++++-\n builtin/repack.c             | 5 +++++\n 2 files changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt\nindex 26afe6ed54..ae750e9e11 100644\n--- a/Documentation/git-repack.txt\n+++ b/Documentation/git-repack.txt\n@@ -9,7 +9,7 @@ git-repack - Pack unpacked objects in a repository\n SYNOPSIS\n --------\n [verse]\n-'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>]\n+'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>]\n \n DESCRIPTION\n -----------\n@@ -92,6 +92,9 @@ other objects in that pack they already have locally.\n \tto be applied that many times to get to the necessary object.\n \tThe default value for --window is 10 and --depth is 50.\n \n+--threads=<n>::\n+\tThis option is passed through to `git pack-objects`.\n+\n --window-memory=<n>::\n \tThis option provides an additional limit on top of `--window`;\n \tthe window size will dynamically scale down so as to not take\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 677bc7c81a..38ba4ef825 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -155,6 +155,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \tint keep_unreachable = 0;\n \tconst char *window = NULL, *window_memory = NULL;\n \tconst char *depth = NULL;\n+\tconst char *threads = NULL;\n \tconst char *max_pack_size = NULL;\n \tint no_reuse_delta = 0, no_reuse_object = 0;\n \tint no_update_server_info = 0;\n@@ -190,6 +191,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\t\t\tN_(\"same as the above, but limit memory size instead of entries count\")),\n \t\tOPT_STRING(0, \"depth\", &depth, N_(\"n\"),\n \t\t\t\tN_(\"limits the maximum delta depth\")),\n+\t\tOPT_STRING(0, \"threads\", &threads, N_(\"n\"),\n+\t\t\t\tN_(\"limits the maximum number of threads\")),\n \t\tOPT_STRING(0, \"max-pack-size\", &max_pack_size, N_(\"bytes\"),\n \t\t\t\tN_(\"maximum size of each packfile\")),\n \t\tOPT_BOOL(0, \"pack-kept-objects\", &pack_kept_objects,\n@@ -234,6 +237,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\targv_array_pushf(&cmd.args, \"--window-memory=%s\", window_memory);\n \tif (depth)\n \t\targv_array_pushf(&cmd.args, \"--depth=%s\", depth);\n+\tif (threads)\n+\t\targv_array_pushf(&cmd.args, \"--threads=%s\", threads);\n \tif (max_pack_size)\n \t\targv_array_pushf(&cmd.args, \"--max-pack-size=%s\", max_pack_size);\n \tif (no_reuse_delta)\n-- \n2.13.0-rc1-202-gb5c0e471fc\n\n"},{"id":"318029","messageId":"20170427032037.em2qvju5pdf2dbbl@sigill.intra.peff.net","threadId":"45812","inReplyTo":"xmqqr30er9tk.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] repack: accept --threads=<n> and pass it down to pack-objects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-27T03:20:38Z","receivedAt":"2017-04-27T03:20:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 26, 2017 at 05:08:39PM -0700, Junio C Hamano wrote:\n\n> We already do so for --window=<n> and --depth=<n>; this will help\n> when the user wants to force --threads=1 for reproducible testing\n> without getting affected by racing multiple threads.\n\nSeems reasonable. I usually just do this with:\n\n  git -c pack.threads=1 repack ...\n\nbut it does not hurt to have a real command line option.\n\n> ---\n>  Documentation/git-repack.txt | 5 ++++-\n>  builtin/repack.c             | 5 +++++\n>  2 files changed, 9 insertions(+), 1 deletion(-)\n\nThe patch itself looks obviously correct.\n\n-Peff\n"}]}