summaryrefslogtreecommitdiff
path: root/git-compat-util.h
AgeCommit message (Collapse)Author
2010-06-21Merge branch 'js/async-thread'Junio C Hamano
* js/async-thread: fast-import: die_nicely() back to vsnprintf (reverts part of ebaa79f) Enable threaded async procedures whenever pthreads is available Dying in an async procedure should only exit the thread, not the process. Reimplement async procedures using pthreads Windows: more pthreads functions Fix signature of fcntl() compatibility dummy Make report() from usage.c public as vreportf() and use it. Modernize t5530-upload-pack-error. Conflicts: http-backend.c
2010-06-21Merge branch 'gv/portable'Junio C Hamano
* gv/portable: test-lib: use DIFF definition from GIT-BUILD-OPTIONS build: propagate $DIFF to scripts Makefile: Tru64 portability fix Makefile: HP-UX 10.20 portability fixes Makefile: HPUX11 portability fixes Makefile: SunOS 5.6 portability fix inline declaration does not work on AIX Allow disabling "inline" Some platforms lack socklen_t type Make NO_{INET_NTOP,INET_PTON} configured independently Makefile: some platforms do not have hstrerror anywhere git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition test_cmp: do not use "diff -u" on platforms that lack one fixup: do not unconditionally disable "diff -u" tests: use "test_cmp", not "diff", when verifying the result Do not use "diff" found on PATH while building and installing enums: omit trailing comma for portability Makefile: -lpthread may still be necessary when libc has only pthread stubs Rewrite dynamic structure initializations to runtime assignment Makefile: pass CPPFLAGS through to fllow customization Conflicts: Makefile wt-status.h
2010-06-13Merge branch 'js/try-to-free-stackable'Junio C Hamano
* js/try-to-free-stackable: Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used Have set_try_to_free_routine return the previous routine
2010-06-02Merge branch 'maint'Junio C Hamano
* maint: git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX Documentation: A...B shortcut for checkout and rebase Documentation/pretty-{formats,options}: better reference for "format:<string>"
2010-06-02git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIXGary V. Vaughan
IRIX 6.5.26m does not define the 'sgi' macro, but it does define an '__sgi' macro. Since later IRIX versions (6.5.29m) define both macros, and since an underscore prefixed macro is preferred anyway, use '__sgi' to detect compilation on SGI IRIX. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-01git-compat-util.h: some platforms with mmap() lack MAP_FAILED definitionGary V. Vaughan
Some platforms with mmap() lack MAP_FAILED definition. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-21Merge branch 'cw/maint-exec-defpath'Junio C Hamano
* cw/maint-exec-defpath: autoconf: Check if <paths.h> exists and set HAVE_PATHS_H exec_cmd.c: replace hard-coded path list with one from <paths.h>
2010-05-21Merge branch 'np/malloc-threading'Junio C Hamano
* np/malloc-threading: Thread-safe xmalloc and xrealloc needs a recursive mutex Make xmalloc and xrealloc thread-safe
2010-05-09Merge branch 'pc/remove-warn'Junio C Hamano
* pc/remove-warn: Remove a redundant errno test in a usage of remove_path Introduce remove_or_warn function Implement the rmdir_or_warn function Generalise the unlink_or_warn function
2010-05-09Have set_try_to_free_routine return the previous routineJohannes Sixt
This effectively requires from the callers of set_try_to_free_routine to treat the try-to-free-routines as a stack. We will need this for the next patch where the only current caller cannot depend on that the previously set routine was the default routine. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-15exec_cmd.c: replace hard-coded path list with one from <paths.h>Chris Webb
The default executable path list used by exec_cmd.c is hard-coded to be "/usr/local/bin:/usr/bin:/bin". Use an appropriate value for the system from <paths.h> when available. Add HAVE_PATHS_H make variables and enable it on Linux, FreeBSD, NetBSD, OpenBSD and GNU where it is known to exist for now. Somebody else may want to do an autoconf support later. Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-03Merge branch 'jn/merge-diff3-label'Junio C Hamano
* jn/merge-diff3-label: merge-recursive: add a label for ancestor cherry-pick, revert: add a label for ancestor revert: clarify label on conflict hunks compat: add mempcpy() checkout -m --conflict=diff3: add a label for ancestor merge_trees(): add ancestor label parameter for diff3-style output merge_file(): add comment explaining behavior wrt conflict style checkout --conflict=diff3: add a label for ancestor ll_merge(): add ancestor label parameter for diff3-style output merge-file --diff3: add a label for ancestor xdl_merge(): move file1 and file2 labels to xmparam structure xdl_merge(): add optional ancestor label to diff3-style output tests: document cherry-pick behavior in face of conflicts tests: document format of conflicts from checkout -m Conflicts: builtin/revert.c
2010-04-03Fix _XOPEN_SOURCE problem on DragonFlyYONETANI Tomokazu
As on FreeBSD, defining _XOPEN_SOURCE to 600 on DragonFly BSD 2.4-RELEASE or later hides symbols from programs, which leads to implicit declaration of functions, making the return value to be assumed an int. On architectures where sizeof(int) < sizeof(void *), this can cause unexpected behaviors or crashes. This change won't affect other OSes unless they define __DragonFly__ macro, or older versions of DragonFly BSD as the current git code doesn't rely on the features only available with _XOPEN_SOURCE set to 600 on DragonFly. Signed-off-by: YONETANI Tomokazu <y0netan1@dragonflybsd.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28Introduce remove_or_warn functionPeter Collingbourne
This patch introduces the remove_or_warn function which is a generalised version of the {unlink,rmdir}_or_warn functions. It takes an additional parameter indicating the mode of the file to be removed. The patch also modifies certain functions to use remove_or_warn where appropriate, and adds a test case for a bug fixed by the use of remove_or_warn. Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28Implement the rmdir_or_warn functionPeter Collingbourne
This patch implements an rmdir_or_warn function (like unlink_or_warn but for directories) that uses the generalised warning code in warn_if_unremovable. Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24Make xmalloc and xrealloc thread-safeNicolas Pitre
By providing a hook for the routine responsible for trying to free some memory on malloc failure, we can ensure that the called routine is protected by the appropriate locks when threads are in play. The obvious offender here was pack-objects which was calling xmalloc() within threads while release_pack_memory() is not thread safe. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-21compat: add mempcpy()Jonathan Nieder
The mempcpy() function was added in glibc 2.1. It is quite handy, so add an implementation for cross-platform use. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-07Make report() from usage.c public as vreportf() and use it.Johannes Sixt
There exist already a number of static functions named 'report', therefore, the function name was changed. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-27Merge branch 'il/maint-xmallocz'Junio C Hamano
* il/maint-xmallocz: Fix integer overflow in unpack_compressed_entry() Fix integer overflow in unpack_sha1_rest() Fix integer overflow in patch_delta() Add xmallocz()
2010-01-26Add xmallocz()Ilari Liusvaara
Add routine for allocating NUL-terminated memory block without risking integer overflow in addition of +1 for NUL byte. [jc: with suggestion from Bill Lear] Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-23msvc: Add a definition of NORETURN compatible with msvc compilerRamsay Jones
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21Merge branch 'ap/merge-backend-opts'Junio C Hamano
* ap/merge-backend-opts: Document that merge strategies can now take their own options Extend merge-subtree tests to test -Xsubtree=dir. Make "subtree" part more orthogonal to the rest of merge-recursive. pull: Fix parsing of -X<option> Teach git-pull to pass -X<option> to git-merge git merge -X<option> git-merge-file --ours, --theirs Conflicts: git-compat-util.h
2010-01-20Merge branch 'jc/symbol-static'Junio C Hamano
* jc/symbol-static: date.c: mark file-local function static Replace parse_blob() with an explanatory comment symlinks.c: remove unused functions object.c: remove unused functions strbuf.c: remove unused function sha1_file.c: remove unused function mailmap.c: remove unused function utf8.c: mark file-local function static submodule.c: mark file-local function static quote.c: mark file-local function static remote-curl.c: mark file-local function static read-cache.c: mark file-local functions static parse-options.c: mark file-local function static entry.c: mark file-local function static http.c: mark file-local functions static pretty.c: mark file-local function static builtin-rev-list.c: mark file-local function static bisect.c: mark file-local function static
2010-01-20date.c: mark file-local function staticJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-18git merge -X<option>Avery Pennarun
Teach "-X <option>" command line argument to "git merge" that is passed to strategy implementations. "ours" and "theirs" autoresolution introduced by the previous commit can be asked to the recursive strategy. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-12Add missing #include to support TIOCGWINSZ on SolarisNguyễn Thái Ngọc Duy
On Linux TIOCGWINSZ is defined somehwere in ioctl.h, which is already included. On Solaris we also need to include termios.h. Without this term_columns() in help.c will think TIOCGWINSZ is not supported and always return 80 columns. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10Introduce usagef() that takes a printf-style formatJonathan Nieder
Some new callers would want to use printf-like formatting, when issuing their usage messages. An option is to change usage() itself also be like printf(), which would make it similar to die() and warn(). But usage() is typically fixed, as opposed to die() and warn() that gives diagnostics depending on the situation. Indeed, the majority of strings given by existing callsites to usage() are fixed strings. If we were to make usage() take printf-style format, they all need to be changed to have "%s" as their first argument. So instead, introduce usagef() so that limited number of callers can use it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-01add NORETURN_PTR for function pointersErik Faye-Lund
Some compilers (including at least MSVC and ARM RVDS) supports NORETURN on function declarations, but not on function pointers. This patch makes it possible to define NORETURN for these compilers, by splitting the NORETURN macro into two - one for function declarations and one for function pointers. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
2009-10-01increase portability of NORETURN declarationsErik Faye-Lund
Some compilers (including at least MSVC) support NORETURN on function declarations, but only before the function-name. This patch makes it possible to define NORETURN to something meaningful for those compilers. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
2009-09-19Make usage of windows.h lean and meanMarius Storm-Olsen
Centralize the include of windows.h in git-compat-util.h, turn on WIN32_LEAN_AND_MEAN to avoid including plenty of other header files which is not needed in Git. Also ensure we load winsock2.h first, so we don't load the older winsock definitions at a later stage, since they contain duplicate definitions. When moving windows.h into git-compat-util.h, we need to protect the definition of struct pollfd in mingw.h, since this file is used by both MinGW and MSVC, and the latter defines this struct in winsock2.h. We need to keep the windows.h include in compat/win32.h, since its shared by both MinGW and Cygwin, and we're not touching Cygwin in this commit. The include in git-compat-util.h is protected with an ifdef WIN32, which is not the case when compiling for Cygwin. Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-19Add platform files for porting to MSVCFrank Li
Add msvc.c and msvc.h to build git under MSVC. Signed-off-by: Frank Li <lznuaa@gmail.com> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-28Merge branch 'lt/block-sha1'Junio C Hamano
* lt/block-sha1: remove ARM and Mozilla SHA1 implementations block-sha1: guard gcc extensions with __GNUC__ make sure byte swapping is optimal for git block-sha1: make the size member first in the context struct
2009-08-20git-compat-util.h: remove superfluous test for __sun__Brandon Casey
This 'ifndef' macro is entered only when __sun__ is not defined. This test will never fail since it is located inside of the 'else' branch of an 'if' macro which tests whether __sun__ is defined. It has had no effect since the merge at 436f66b7. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-18make sure byte swapping is optimal for gitNicolas Pitre
We rely on ntohl() and htonl() to perform byte swapping in many places. However, some platforms have libraries providing really poor implementations of those which might cause significant performance issues, especially with the block-sha1 code. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-23janitor: add DIV_ROUND_UP and use it.Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-23refactor: use bitsizeof() instead of 8 * sizeof()Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-11git-compat-util.h: adjust for SGI IRIX 6.5Brandon Casey
Don't define _XOPEN_SOURCE Do define _SGI_SOURCE Defining _XOPEN_SOURCE prevents many of the common functions and macros from being defined. _Not_ setting _XOPEN_SOURCE, and instead setting _SGI_SOURCE, provides all of the XPG4, XPG5, BSD, POSIX functions and declarations, _BUT_ provides a horribly broken snprintf(). SGI does have a working snprintf(), but it is only provided when _NO_XOPEN5 evaluates to zero, and this only happens if _XOPEN_SOURCE is defined which, as mentioned above, prevents many other common functions and defines. The broken snprintf will be worked around with SNPRINTF_RETURNS_BOGUS in the Makefile in a later patch. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06Merge branch 'tr/die_errno'Junio C Hamano
* tr/die_errno: Use die_errno() instead of die() when checking syscalls Convert existing die(..., strerror(errno)) to die_errno() die_errno(): double % in strerror() output just in case Introduce die_errno() that appends strerror(errno) to die()
2009-06-27Introduce die_errno() that appends strerror(errno) to die()Thomas Rast
There are many calls to die() that do, or should, report strerror(errno) to indicate how the syscall they guard failed. Introduce a small helper function for this case. Note: - POSIX says vsnprintf can modify errno in some unlikely cases, so we have to use errno early. - We take some care to pass the original format to die_routine(), in case someone wants to call die_errno() with custom format characters. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-13Merge branch 'bc/solaris'Junio C Hamano
* bc/solaris: configure: test whether -lresolv is needed Makefile: insert SANE_TOOL_PATH to PATH before /bin or /usr/bin git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8 Makefile: add section for SunOS 5.7 Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Makefile: define __sun__ on SunOS git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Conflicts: Makefile
2009-06-09git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8Brandon Casey
The Sun c99 compiler as recent as version 5.8 Patch 121016-06 2007/08/01 produces an error when compiling diff-delta.c. This source file #includes the delta.h header file which pre-declares a struct which is later defined to contain a flex array member. The Sun c99 compiler fails to compile diff-delta.c and gives the following error: "diff-delta.c", line 314: identifier redeclared: create_delta current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void previous: function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void : "delta.h", line 44 c99: acomp failed for diff-delta.c So, avoid using this c99 feature when compiling with the Sun c compilers version 5.8 and older (the most recent version tested). Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06git-compat-util.h: tweak the way _XOPEN_SOURCE is set on SolarisBrandon Casey
On Solaris, when _XOPEN_EXTENDED is set, its header file forces the programs to be XPG4v2, defeating any _XOPEN_SOURCE setting to say we are XPG5 or XPG6. Also on Solaris, XPG6 programs must be compiled with a c99 compiler, while non XPG6 programs must be compiled with a pre-c99 compiler. So when compiling on Solaris, always refrain from setting _XOPEN_EXTENDED, and then set _XOPEN_SOURCE to 600 or 500 based on whether a c99 compiler is being used or not. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-03Merge branch 'da/pretty-tempname'Junio C Hamano
* da/pretty-tempname: diff: generate pretty filenames in prep_temp_blob() compat: add a basename() compatibility function compat: add a mkstemps() compatibility function Conflicts: Makefile
2009-06-01compat: add a basename() compatibility functionDavid Aguilar
Some systems such as Windows lack libgen.h so provide a basename() implementation for cross-platform use. This introduces the NO_LIBGEN_H construct to the Makefile and autoconf scripts. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01compat: add a mkstemps() compatibility functionDavid Aguilar
mkstemps() is a BSD extension so provide an implementation for cross-platform use. Signed-off-by: David Aguilar <davvid@gmail.com> Tested-by: Johannes Sixt <j6t@kdbg.org> (Windows) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6Junio C Hamano
In git-compat-util.h, we do #define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE_EXTENDED 1 unless we are on BSD or SCO. On OpenSolaris (200811), /usr/include/sys/feature_tests.h has this nice table: Feature Test Macro Specification ------------------------------------------------ ------------- _XOPEN_SOURCE XPG3 _XOPEN_SOURCE && _XOPEN_VERSION = 4 XPG4 _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2 _XOPEN_SOURCE = 500 XPG5 _XOPEN_SOURCE = 600 (or POSIX_C_SOURCE=200112L) XPG6 Later in the same header, compilation with -c99 is made to fail if _XPG6 is not set, like this: #if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6)) #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \ and pre-2001 POSIX applications" #elif ... The problem is that they check things in an order that is inconvenient for us. When they see _XOPEN_SOURCE_EXTENDED, they declare that we are XPG4v2, regardless of the value of _XOPEN_SOURCE. To work around this problem, do not define _XOPEN_SOURCE_EXTENDED on Sun's. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-30Introduce an unlink(2) wrapper which gives warning if unlink failedAlex Riesen
This seem to be a very common pattern in the current code. The function prints a generic removal failure message, the file name which failed and readable errno presentation. The function preserves errno and always returns the value unlink(2) returned, but prints no message for ENOENT, as it was the most often filtered out in the code calling unlink. Besides, removing a file is anyway the purpose of calling unlink. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27NetBSD compilation fixPatrick Welche
Similar to other BSD variants, it needs USE_ST_TIMESPEC. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20Windows: Skip fstat/lstat optimization in write_entry()Johannes Sixt
Commit e4c72923 (write_entry(): use fstat() instead of lstat() when file is open, 2009-02-09) introduced an optimization of write_entry(). Unfortunately, we cannot take advantage of this optimization on Windows because there is no guarantee that the time stamps are updated before the file is closed: "The only guarantee about a file timestamp is that the file time is correctly reflected when the handle that makes the change is closed." (http://msdn.microsoft.com/en-us/library/ms724290(VS.85).aspx) The failure of this optimization on Windows can be observed most easily by running a 'git checkout' that has to update several large files. In this case, 'git checkout' will report modified files, but infact only the timestamps were incorrectly recorded in the index, as can be verified by a subsequent 'git diff', which shows no change. Dmitry Potapov reports the same fix needs on Cygwin; this commit contains his updates for that. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-19MinGW: implement mmapJanos Laube
Add USE_WIN32_MMAP which triggers the use of windows' native file memory mapping functionality in git_mmap()/git_munmap() functions. As git functions currently use mmap with MAP_PRIVATE set only, this implementation supports only that mode for now. On Windows, offsets for memory mapped files need to match the allocation granularity. Take this into account when calculating the packed git- windowsize and file offsets. At the moment, the only function which makes use of offsets in conjunction with mmap is use_pack() in sha1-file.c. Git fast-import's code path tries to map a portion of the temporary packfile that exceeds the current filesize, i.e. offset+length is greater than the filesize. The NO_MMAP code worked with that since pread() just reads the file content until EOF and returns gracefully, while MapViewOfFile() aborts the mapping and returns 'Access Denied'. Working around that by determining the filesize and adjusting the length parameter. Signed-off-by: Janos Laube <janos.dev@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>