Skip to content

Commit

Permalink
Ensure core.packedGitWindowSize cannot be less than 2 pages.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Dec 29, 2006
1 parent bac2614 commit 40be827
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ int git_default_config(const char *var, const char *value)
int pgsz = getpagesize();
packed_git_window_size = git_config_int(var, value);
packed_git_window_size /= pgsz;
if (!packed_git_window_size)
packed_git_window_size = 1;
if (packed_git_window_size < 2)
packed_git_window_size = 2;
packed_git_window_size *= pgsz;
return 0;
}
Expand Down

0 comments on commit 40be827

Please sign in to comment.