From: Andreas Ericsson <ae@op5.se>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] pack-objects: Use git_config_magic_int()
Date: Tue, 12 Feb 2008 09:23:59 +0100 [thread overview]
Message-ID: <47B1579F.8030407@op5.se> (raw)
In-Reply-To: <1202804110-3715-1-git-send-email-ae@op5.se>
This lets users specify "auto" as a valid parameter to --threads
and pack.threads instead of having to remember what the magic
number 0 actually meant. 0 still works. This is just a nicer way
of saying it.
Signed-off-by: Andreas Ericsson <ae@op5.se>
---
Documentation/config.txt | 4 ++--
Documentation/git-pack-objects.txt | 4 ++--
builtin-pack-objects.c | 16 ++++++++++------
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index e9f26ed..398c6e0 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -756,8 +756,8 @@ pack.threads::
warning. This is meant to reduce packing time on multiprocessor
machines. The required amount of memory for the delta search window
is however multiplied by the number of threads.
- Specifying 0 will cause git to auto-detect the number of CPU's
- and set the number of threads accordingly.
+ Specifying 'auto' or 0 will cause git to auto-detect the number
+ of CPU's and set the number of threads accordingly.
pack.indexVersion::
Specify the default pack index version. Valid values are 1 for
diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index 5c1bd3b..e4b6fe9 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -177,8 +177,8 @@ base-name::
This is meant to reduce packing time on multiprocessor machines.
The required amount of memory for the delta search window is
however multiplied by the number of threads.
- Specifying 0 will cause git to auto-detect the number of CPU's
- and set the number of threads accordingly.
+ Specifying 'auto' or 0 will cause git to auto-detect the number
+ of CPU's and set the number of threads accordingly.
--index-version=<version>[,<offset>]::
This is intended to be used by the test suite only. It allows
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index a7ffb53..be04829 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1857,7 +1857,7 @@ static int git_pack_config(const char *k, const char *v)
return 0;
}
if (!strcmp(k, "pack.threads")) {
- delta_search_threads = git_config_int(k, v);
+ delta_search_threads = git_config_magic_int(k, v, "auto", 0);
if (delta_search_threads < 0)
die("invalid number of threads specified (%d)",
delta_search_threads);
@@ -2128,11 +2128,15 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
continue;
}
if (!prefixcmp(arg, "--threads=")) {
- char *end;
- delta_search_threads = strtoul(arg+10, &end, 0);
-
- if (!arg[10] || *end || delta_search_threads < 0)
- usage(pack_usage);
+ if (!strcasecmp(arg+10, "auto"))
+ delta_search_threads = 0;
+ else {
+ char *end;
+ delta_search_threads = strtoul(arg+10, &end, 0);
+
+ if (!arg[10] || *end || delta_search_threads < 0)
+ usage(pack_usage);
+ }
#ifndef THREADED_DELTA_SEARCH
if (delta_search_threads > 1)
warning("no threads support, "
--
1.5.4.rc5.11.g0eab8
parent reply other threads:[~2008-02-12 8:25 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1202804110-3715-1-git-send-email-ae@op5.se>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47B1579F.8030407@op5.se \
--to=ae@op5.se \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.