Git development
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] Support common unit suffixes in packedGitWindowSize.
Date: Sat, 30 Dec 2006 21:02:42 -0500	[thread overview]
Message-ID: <20061231020242.GB5366@spearce.org> (raw)
In-Reply-To: <bc77965370c83bccc9b04c68911ab7e9d7d83d58.1167530501.git.spearce@spearce.org>

Make use of the new git_config_datasize function to parse the value
for core.packedGitWindowSize and core.packedGitLimit, as these
need to be a bytecount internally but the user will probably want
to specify them with standard units, such as "32 MiB".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Applies on top of sp/mmap.

 Documentation/config.txt |   10 ++++++++--
 config.c                 |    6 +++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d71653d..17d5b53 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -123,21 +123,27 @@ core.packedGitWindowSize::
 	single mapping operation.  Larger window sizes may allow
 	your system to process a smaller number of large pack files
 	more quickly.  Smaller window sizes will negatively affect
-	performance due to increased calls to the opreating system's
+	performance due to increased calls to the operating system's
 	memory manager, but may improve performance when accessing
 	a large number of large pack files.  Default is 32 MiB,
 	which should be reasonable for all users/operating systems.
 	You probably do not need to adjust this value.
 
+	Common unit suffixes of 'k', 'kb', 'kib', 'm', 'mb', 'mib',
+	'g', 'gb', 'gib' are supported.
+
 core.packedGitLimit::
 	Maximum number of bytes to map simultaneously into memory
 	from pack files.  If Git needs to access more than this many
 	bytes at once to complete an operation it will unmap existing
 	regions to reclaim virtual address space within the process.
 	Default is 256 MiB, which should be reasonable for all
-	users/operating systems, except on largest Git projects.
+	users/operating systems, except on the largest projects.
 	You probably do not need to adjust this value.
 
+	Common unit suffixes of 'k', 'kb', 'kib', 'm', 'mb', 'mib',
+	'g', 'gb', 'gib' are supported.
+
 alias.*::
 	Command aliases for the gitlink:git[1] command wrapper - e.g.
 	after defining "alias.last = cat-file commit HEAD", the invocation
diff --git a/config.c b/config.c
index 07ad2f1..a9f4497 100644
--- a/config.c
+++ b/config.c
@@ -324,8 +324,8 @@ int git_default_config(const char *var, const char *value)
 	}
 
 	if (!strcmp(var, "core.packedgitwindowsize")) {
-		int pgsz = getpagesize();
-		packed_git_window_size = git_config_int(var, value);
+		unsigned long pgsz = getpagesize();
+		packed_git_window_size = git_config_datasize(var, value);
 		packed_git_window_size /= pgsz;
 		if (packed_git_window_size < 2)
 			packed_git_window_size = 2;
@@ -334,7 +334,7 @@ int git_default_config(const char *var, const char *value)
 	}
 
 	if (!strcmp(var, "core.packedgitlimit")) {
-		packed_git_limit = git_config_int(var, value);
+		packed_git_limit = git_config_datasize(var, value);
 		return 0;
 	}
 
-- 
1.5.0.rc0.g6bb1

           reply	other threads:[~2006-12-31  2:02 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <bc77965370c83bccc9b04c68911ab7e9d7d83d58.1167530501.git.spearce@spearce.org>]

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=20061231020242.GB5366@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox