@matheusbsbs / matheus-bagliano / commits / 40be82723c
Fork 0

Ensure core.packedGitWindowSize cannot be less than 2 pages.

We cannot allow a window to be smaller than 2 system pages. This limitation is necessary to support the feature of use_pack() where we always supply at least 20 bytes after the offset to help the object header and delta base parsing routines. If packedGitWindowSize were allowed to be as small as 1 system page then we would be completely unable to access an object header which spanned over a page as we would never be able to arrange a mapping such that the header was contiguous in virtual memory. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Dec 23, 2006 at 02:34 UTC 40be82723ca35d4e95daccc3ccf6456f6876430e
1 file changed +2 -2
config.c
+2 -2
@@ -302,8 +302,8 @@ int git_default_config(const char *var, const char *value)
302 int pgsz = getpagesize();
303 packed_git_window_size = git_config_int(var, value);
304 packed_git_window_size /= pgsz;
305 - if (!packed_git_window_size)
306 - packed_git_window_size = 1;
305 + if (packed_git_window_size < 2)
306 + packed_git_window_size = 2;
307 packed_git_window_size *= pgsz;
308 return 0;
309 }