{"thread":{"id":"6163","subject":"[PATCH 2/2] Support common unit suffixes in packedGitWindowSize.","startedAt":"2006-12-31T02:02:42Z","lastAt":"2006-12-31T02:02:42Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"30531","messageId":"20061231020242.GB5366@spearce.org","threadId":"6163","inReplyTo":"bc77965370c83bccc9b04c68911ab7e9d7d83d58.1167530501.git.spearce@spearce.org","subject":"[PATCH 2/2] Support common unit suffixes in packedGitWindowSize.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-12-31T02:02:42Z","receivedAt":"2006-12-31T02:02:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Make use of the new git_config_datasize function to parse the value\nfor core.packedGitWindowSize and core.packedGitLimit, as these\nneed to be a bytecount internally but the user will probably want\nto specify them with standard units, such as \"32 MiB\".\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n Applies on top of sp/mmap.\n\n Documentation/config.txt |   10 ++++++++--\n config.c                 |    6 +++---\n 2 files changed, 11 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d71653d..17d5b53 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -123,21 +123,27 @@ core.packedGitWindowSize::\n \tsingle mapping operation.  Larger window sizes may allow\n \tyour system to process a smaller number of large pack files\n \tmore quickly.  Smaller window sizes will negatively affect\n-\tperformance due to increased calls to the opreating system's\n+\tperformance due to increased calls to the operating system's\n \tmemory manager, but may improve performance when accessing\n \ta large number of large pack files.  Default is 32 MiB,\n \twhich should be reasonable for all users/operating systems.\n \tYou probably do not need to adjust this value.\n \n+\tCommon unit suffixes of 'k', 'kb', 'kib', 'm', 'mb', 'mib',\n+\t'g', 'gb', 'gib' are supported.\n+\n core.packedGitLimit::\n \tMaximum number of bytes to map simultaneously into memory\n \tfrom pack files.  If Git needs to access more than this many\n \tbytes at once to complete an operation it will unmap existing\n \tregions to reclaim virtual address space within the process.\n \tDefault is 256 MiB, which should be reasonable for all\n-\tusers/operating systems, except on largest Git projects.\n+\tusers/operating systems, except on the largest projects.\n \tYou probably do not need to adjust this value.\n \n+\tCommon unit suffixes of 'k', 'kb', 'kib', 'm', 'mb', 'mib',\n+\t'g', 'gb', 'gib' are supported.\n+\n alias.*::\n \tCommand aliases for the gitlink:git[1] command wrapper - e.g.\n \tafter defining \"alias.last = cat-file commit HEAD\", the invocation\ndiff --git a/config.c b/config.c\nindex 07ad2f1..a9f4497 100644\n--- a/config.c\n+++ b/config.c\n@@ -324,8 +324,8 @@ int git_default_config(const char *var, const char *value)\n \t}\n \n \tif (!strcmp(var, \"core.packedgitwindowsize\")) {\n-\t\tint pgsz = getpagesize();\n-\t\tpacked_git_window_size = git_config_int(var, value);\n+\t\tunsigned long pgsz = getpagesize();\n+\t\tpacked_git_window_size = git_config_datasize(var, value);\n \t\tpacked_git_window_size /= pgsz;\n \t\tif (packed_git_window_size < 2)\n \t\t\tpacked_git_window_size = 2;\n@@ -334,7 +334,7 @@ int git_default_config(const char *var, const char *value)\n \t}\n \n \tif (!strcmp(var, \"core.packedgitlimit\")) {\n-\t\tpacked_git_limit = git_config_int(var, value);\n+\t\tpacked_git_limit = git_config_datasize(var, value);\n \t\treturn 0;\n \t}\n \n-- \n1.5.0.rc0.g6bb1\n"}]}