All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] repack: accept --threads=<n> and pass it down to pack-objects
@ 2017-04-27  0:08 Junio C Hamano
  2017-04-27  3:20 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2017-04-27  0:08 UTC (permalink / raw)
  To: git

We already do so for --window=<n> and --depth=<n>; this will help
when the user wants to force --threads=1 for reproducible testing
without getting affected by racing multiple threads.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-repack.txt | 5 ++++-
 builtin/repack.c             | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 26afe6ed54..ae750e9e11 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -9,7 +9,7 @@ git-repack - Pack unpacked objects in a repository
 SYNOPSIS
 --------
 [verse]
-'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>]
+'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>]
 
 DESCRIPTION
 -----------
@@ -92,6 +92,9 @@ other objects in that pack they already have locally.
 	to be applied that many times to get to the necessary object.
 	The default value for --window is 10 and --depth is 50.
 
+--threads=<n>::
+	This option is passed through to `git pack-objects`.
+
 --window-memory=<n>::
 	This option provides an additional limit on top of `--window`;
 	the window size will dynamically scale down so as to not take
diff --git a/builtin/repack.c b/builtin/repack.c
index 677bc7c81a..38ba4ef825 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -155,6 +155,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 	int keep_unreachable = 0;
 	const char *window = NULL, *window_memory = NULL;
 	const char *depth = NULL;
+	const char *threads = NULL;
 	const char *max_pack_size = NULL;
 	int no_reuse_delta = 0, no_reuse_object = 0;
 	int no_update_server_info = 0;
@@ -190,6 +191,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 				N_("same as the above, but limit memory size instead of entries count")),
 		OPT_STRING(0, "depth", &depth, N_("n"),
 				N_("limits the maximum delta depth")),
+		OPT_STRING(0, "threads", &threads, N_("n"),
+				N_("limits the maximum number of threads")),
 		OPT_STRING(0, "max-pack-size", &max_pack_size, N_("bytes"),
 				N_("maximum size of each packfile")),
 		OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
@@ -234,6 +237,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 		argv_array_pushf(&cmd.args, "--window-memory=%s", window_memory);
 	if (depth)
 		argv_array_pushf(&cmd.args, "--depth=%s", depth);
+	if (threads)
+		argv_array_pushf(&cmd.args, "--threads=%s", threads);
 	if (max_pack_size)
 		argv_array_pushf(&cmd.args, "--max-pack-size=%s", max_pack_size);
 	if (no_reuse_delta)
-- 
2.13.0-rc1-202-gb5c0e471fc


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] repack: accept --threads=<n> and pass it down to pack-objects
  2017-04-27  0:08 [PATCH] repack: accept --threads=<n> and pass it down to pack-objects Junio C Hamano
@ 2017-04-27  3:20 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2017-04-27  3:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wed, Apr 26, 2017 at 05:08:39PM -0700, Junio C Hamano wrote:

> We already do so for --window=<n> and --depth=<n>; this will help
> when the user wants to force --threads=1 for reproducible testing
> without getting affected by racing multiple threads.

Seems reasonable. I usually just do this with:

  git -c pack.threads=1 repack ...

but it does not hurt to have a real command line option.

> ---
>  Documentation/git-repack.txt | 5 ++++-
>  builtin/repack.c             | 5 +++++
>  2 files changed, 9 insertions(+), 1 deletion(-)

The patch itself looks obviously correct.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-27  3:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27  0:08 [PATCH] repack: accept --threads=<n> and pass it down to pack-objects Junio C Hamano
2017-04-27  3:20 ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.