Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better mmap() emulation #486

Merged
merged 3 commits into from
Oct 13, 2015
Merged

Better mmap() emulation #486

merged 3 commits into from
Oct 13, 2015

Commits on Oct 5, 2015

  1. win32mmap: set errno appropriately

    It is not really helpful when a `git fetch` fails with the message:
    
    	fatal: mmap failed: No error
    
    In the particular instance encountered by a colleague of yours truly,
    the Win32 error code was ERROR_COMMITMENT_LIMIT which means that the
    page file is not big enough.
    
    Let's make the message
    
    	fatal: mmap failed: File too large
    
    instead, which is only marginally better, but which can be associated
    with the appropriate work-around: setting `core.packedGitWindowSize` to
    a relatively small value.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Oct 5, 2015
    Configuration menu
    Copy the full SHA
    f21df00 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2015

  1. mmap(win32): avoid copy-on-write when it is unnecessary

    Often we are mmap()ing read-only. In those cases, it is wasteful to map in
    copy-on-write mode. Even worse: it can cause errors where we run out of
    space in the page file.
    
    So let's be extra careful to map files in read-only mode whenever
    possible.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Oct 13, 2015
    Configuration menu
    Copy the full SHA
    5cba588 View commit details
    Browse the repository at this point in the history
  2. mmap(win32): avoid expensive fstat() call

    On Windows, we have to emulate the fstat() call to fill out information
    that takes extra effort to obtain, such as the file permissions/type.
    
    If all we want is the file size, we can use the much cheaper
    GetFileSizeEx() function (available since Windows XP).
    
    Suggested by Philip Kelley.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Oct 13, 2015
    Configuration menu
    Copy the full SHA
    100a1f1 View commit details
    Browse the repository at this point in the history