Skip to content
Commits on Jan 30, 2010
  1. @j6t @gitster

    Implement pthread_cond_broadcast on Windows

    j6t committed with gitster
    See http://www.cse.wustl.edu/~schmidt/win32-cv-1.html, section "The
    SignalObjectAndWait solution". But note that this implementation does not
    use SignalObjectAndWait (which is needed to achieve fairness, but we do
    not need fairness).
    
    Note that our implementations of pthread_cond_broadcast and
    pthread_cond_signal require that they are invoked with the mutex held that
    is used in the pthread_cond_wait calls.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 23, 2010
  1. @gitster

    msvc: Fix a compiler warning due to an incorrect pointer cast

    Ramsay Jones committed with gitster
    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>
  2. @gitster

    msvc: Fix an "unrecognized option" linker warning

    Ramsay Jones committed with gitster
    Having recently added support for building git-imap-send on
    Windows, we now link against OpenSSL libraries, and the linker
    issues the following warning:
    
        warning LNK4044: unrecognized option '/lssl'; ignored
    
    In order to suppress the warning, we change the msvc linker
    script to translate an '-lssl' parameter to the ssleay32.lib
    library.
    
    Note that the linker script was already including ssleay32.lib
    (along with libeay32.lib) as part of the translation of the
    '-lcrypto' library parameter.  However, libeay32.dll does not
    depend on ssleay32.dll and can be used stand-alone, so we remove
    ssleay32.lib from the '-lcrypto' translation.
    
    The dependence of ssleay32.dll on libeay32.dll is represented in
    the Makefile by the NEEDS_CRYPTO_WITH_SSL build variable.
    
    Also, add the corresponding change to the buildsystem generator.
    
    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>
Commits on Jan 17, 2010
  1. @j6t @gitster

    Do not use date.c:tm_to_time_t() from compat/mingw.c

    j6t committed with gitster
    To implement gettimeofday(), a broken-down UTC time was requested from the
    system using GetSystemTime(), then tm_to_time_t() was used to convert it
    to a time_t because it does not look at the current timezone, which
    mktime() would do.
    
    Use GetSystemTimeAsFileTime() and a different conversion path to avoid this
    back-reference from the compatibility layer to the generic code.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @ahaczewski @gitster

    MSVC: Windows-native implementation for subset of Pthreads API

    ahaczewski committed with gitster
    This patch implements native to Windows subset of pthreads API used by Git.
    It allows to remove Pthreads for Win32 dependency for MSVC, msysgit and
    Cygwin.
    
    [J6t: If the MinGW build was built as part of the msysgit build
    environment, then threading was already enabled because the
    pthreads-win32 package is available in msysgit. With this patch, we can now
    enable threaded code unconditionally.]
    
    Signed-off-by: Andrzej K. Haczewski <ahaczewski@gmail.com>
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @gitster

    MSVC: Fix an "incompatible pointer types" compiler warning

    Ramsay Jones committed with gitster
    In particular, the following warning is issued while compiling
    compat/msvc.c:
    
        ...mingw.c(223) : warning C4133: 'function' : incompatible \
    types - from '_stati64 *' to '_stat64 *'
    
    which relates to a call of _fstati64() in the mingw_fstat()
    function definition.
    
    This is caused by various layers of macro magic and attempts to
    avoid macro redefinition compiler warnings. For example, the call
    to _fstati64() mentioned above is actually a call to _fstat64(),
    and expects a pointer to a struct _stat64 rather than the struct
    _stati64 which is passed to mingw_fstat().
    
    The definition of struct _stati64 given in compat/msvc.h had the
    same "shape" as the definition of struct _stat64, so the call to
    _fstat64() does not actually cause any runtime errors, but the
    structure types are indeed incompatible.
    
    In order to avoid the compiler warning, we add declarations for the
    mingw_lstat() and mingw_fstat() functions and supporting macros to
    msvc.h, suppressing the corresponding declarations in mingw.h, so
    that we can use the appropriate structure type (and function) names
    from the msvc headers.
    
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @j6t @gitster

    Windows: avoid the "dup dance" when spawning a child process

    j6t committed with gitster
    When stdin, stdout, or stderr must be redirected for a child process that
    on Windows is spawned using one of the spawn() functions of Microsoft's
    C runtime, then there is no choice other than to
    
    1. make a backup copy of fd 0,1,2 with dup
    2. dup2 the redirection source fd into 0,1,2
    3. spawn
    4. dup2 the backup back into 0,1,2
    5. close the backup copy and the redirection source
    
    We used this idiom as well -- but we are not using the spawn() functions
    anymore!
    
    Instead, we have our own implementation. We had hardcoded that stdin,
    stdout, and stderr of the child process were inherited from the parent's
    fds 0, 1, and 2. But we can actually specify any fd.
    
    With this patch, the fds to inherit are passed from start_command()'s
    WIN32 section to our spawn implementation. This way, we can avoid the
    backup copies of the fds.
    
    The backup copies were a bug waiting to surface: The OS handles underlying
    the dup()ed fds were inherited by the child process (but were not
    associated with a file descriptor in the child). Consequently, the file or
    pipe represented by the OS handle remained open even after the backup copy
    was closed in the parent process until the child exited.
    
    Since our implementation of pipe() creates non-inheritable OS handles, we
    still dup() file descriptors in start_command() because dup() happens to
    create inheritable duplicates. (A nice side effect is that the fd cleanup
    in start_command is the same for Windows and Unix and remains unchanged.)
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @j6t @gitster

    Windows: simplify the pipe(2) implementation

    j6t committed with gitster
    Our implementation of pipe() must create non-inheritable handles for the
    reason that when a child process is started, there is no opportunity to
    close the unneeded pipe ends in the child (on POSIX this is done between
    fork() and exec()).
    
    Previously, we used the _pipe() function provided by Microsoft's C runtime
    (which creates inheritable handles) and then turned the handles into
    non-inheritable handles using the DuplicateHandle() API.
    
    Simplify the procedure by using the CreatePipe() API, which can create
    non-inheritable handles right from the beginning.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. @j6t @gitster

    Windows: boost startup by avoiding a static dependency on shell32.dll

    j6t committed with gitster
    This DLL is only needed to invoke the browser in a "git help" call. By
    looking up the only function that we need at runtime, we can avoid the
    startup costs of this DLL.
    
    DLL usage can be profiled with Microsoft's Dependency Walker. For example,
    a call to "git diff-files" loaded
    
    before:  19 DLLs
    after:    9 DLLs
    
    As a result, the runtime of 'make -j2 test' went down from 16:00min
    to 12:40min on one of my boxes.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 25, 2009
  1. @d0k @gitster

    Explicitly truncate bswap operand to uint32_t

    d0k committed with gitster
    There are some places in git where a long is passed to htonl/ntohl. llvm
    doesn't support matching operands of different bitwidths intentionally.
    This patch fixes the build with llvm-gcc (and clang) on x86_64.
    
    Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 24, 2009
  1. @mstorsjo @gitster

    Enable support for IPv6 on MinGW

    mstorsjo committed with gitster
    The IPv6 support functions are loaded dynamically, to maintain backwards
    compatibility with versions of Windows prior to XP, and fallback wrappers
    are provided, implemented in terms of gethostbyname and gethostbyaddr.
    
    Signed-off-by: Martin Storsjo <martin@martin.st>
    Acked-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @mstorsjo @gitster

    Refactor winsock initialization into a separate function

    mstorsjo committed with gitster
    The winsock library must be initialized. Since gethostbyname() is the
    first function that calls into winsock, it was overridden to do the
    initialization. This refactoring helps the next patch, where other
    functions can be called earlier.
    
    Signed-off-by: Martin Storsjo <martin@martin.st>
    Acked-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 21, 2009
  1. @gitster

    Merge branch 'rj/cygwin-msvc'

    gitster committed
    * rj/cygwin-msvc:
      MSVC: Add support for building with NO_MMAP
      Makefile: keep MSVC and Cygwin configuration separate
Commits on Nov 18, 2009
  1. @gitster

    Merge branch 'ef/msys-imap'

    gitster committed
    * ef/msys-imap:
      Windows: use BLK_SHA1 again
      MSVC: Enable OpenSSL, and translate -lcrypto
      mingw: enable OpenSSL
      mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle
      imap-send: build imap-send on Windows
      imap-send: fix compilation-error on Windows
      imap-send: use run-command API for tunneling
      imap-send: use separate read and write fds
      imap-send: remove useless uid code
Commits on Nov 9, 2009
  1. @gitster

    MSVC: Add support for building with NO_MMAP

    Ramsay Jones committed with gitster
    When the NO_MMAP build variable is set, the msvc linker complains:
    
        error LNK2001: unresolved external symbol _getpagesize
    
    The msvc libraries do not define the getpagesize() function,
    so we move the mingw_getpagesize() implementation from the
    conditionally built win32mmap.c file to mingw.c.
    
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 30, 2009
  1. @sschuberth @gitster

    Use faster byte swapping when compiling with MSVC

    sschuberth committed with gitster
    When compiling with MSVC on x86-compatible, use an intrinsic for byte swapping.
    In contrast to the GCC path, we do not prefer inline assembly here as it is not
    supported for the x64 platform.
    
    Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 23, 2009
  1. @mstormo @j6t

    MSVC: Enable OpenSSL, and translate -lcrypto

    mstormo committed with j6t
    We don't use crypto, but rather require libeay32 and
    ssleay32. handle it in both the Makefile msvc linker
    script, and the buildsystem generator.
    
    Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
    Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 20, 2009
  1. @kusma @gitster

    mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle

    kusma committed with gitster
    SSL_set_fd (and friends) expects a OS file handle on Windows, not
    a file descriptor as on UNIX(-ish).
    
    This patch makes the Windows version of SSL_set_fd behave like the
    UNIX versions, by calling _get_osfhandle on it's input.
    
    Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
    Acked-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 9, 2009
  1. @gitster

    Merge branch 'ms/msvc'

    gitster committed
    * ms/msvc:
      Fix the exit code of MSVC build scripts on cygwin
      Fix MSVC build on cygwin
  2. @gitster

    Fix the exit code of MSVC build scripts on cygwin

    Ramsay Jones committed with gitster
    During an MSVC build on cygwin, the make program did not notice
    when the compiler or linker exited with an error. This was caused
    by the scripts exiting with the value returned by system() directly.
    
    On POSIX-like systems, such as cygwin, the return value of system()
    has the exit code of the executed command encoded in the first byte
    (ie the value is shifted up by 8 bits). This allows the bottom
    7 bits to contain the signal number of a terminated process, while
    the eighth bit indicates whether a core-dump was produced. (A value
    of -1 indicates that the command failed to execute.)
    
    The make program, however, expects the exit code to be encoded in the
    bottom byte. Futhermore, it apparently masks off and ignores anything
    in the upper bytes.
    
    However, these scripts are (naturally) intended to be used on the
    windows platform, where we can not assume POSIX-like semantics from
    a perl implementation (eg ActiveState). So, in general, we can not
    assume that shifting the return value right by eight will get us
    the exit code.
    
    In order to improve portability, we assume that a zero return from
    system() indicates success, whereas anything else indicates failure.
    Since we don't need to know the exact exit code from the compiler
    or linker, we simply exit with 0 (success) or 1 (failure).
    
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 2, 2009
  1. @peff

    Fix some printf format warnings

    Ramsay Jones committed with peff
    commit 51ea551 ("make sure byte swapping is optimal for git"
    2009-08-18) introduced a "sane definition for ntohl()/htonl()"
    for use on some GNU C platforms. Unfortunately, for some of
    these platforms, this results in the introduction of a problem
    which is essentially the reverse of a problem that commit 6e1c234
    ("Fix some warnings (on cygwin) to allow -Werror" 2008-07-3) was
    intended to fix.
    
    In particular, on platforms where the uint32_t type is defined
    to be unsigned long, the return type of the new ntohl()/htonl()
    is causing gcc to issue printf format warnings, such as:
    
        warning: long unsigned int format, unsigned int arg (arg 3)
    
    (nine such warnings, covering six different files). The earlier
    commit (6e1c234) needed to suppress these same warnings, except
    that the types were in the opposite direction; namely the format
    specifier ("%u") was 'unsigned int' and the argument type (ie the
    return type of ntohl()) was 'long unsigned int' (aka uint32_t).
    
    In order to suppress these warnings, the earlier commit used the
    (C99) PRIu32 format specifier, since the definition of this macro
    is suitable for use with the uint32_t type on that platform.
    This worked because the return type of the (original) platform
    ntohl()/htonl() functions was uint32_t.
    
    In order to suppress these warnings, we change the return type of
    the new byte swapping functions in the compat/bswap.h header file
    from 'unsigned int' to uint32_t.
    
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Acked-by: Nicolas Pitre <nico@fluxnic.net>
    Signed-off-by: Jeff King <peff@peff.net>
Commits on Sep 19, 2009
  1. @mstormo @gitster

    Add scripts to generate projects for other buildsystems (MSVC vcproj,…

    mstormo committed with gitster
    … QMake)
    
    These scripts generate projects for the MSVC IDE (.vcproj files) or
    QMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.
    
    This enables us to simply do the necesarry changes in the Makefile, and you
    can update the other buildsystems by regenerating the files. Keeping the
    other buildsystems up-to-date with main development.
    
    The generator system is designed to easily drop in pm's for other
    buildsystems as well, if someone has an itch. However, the focus has been
    Windows development, so the 'engine' might need patches to support any
    platform.
    
    Also add some .gitignore entries for MSVC files.
    
    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>
  2. @mstormo @gitster

    Add README for MSVC build

    mstormo committed with gitster
    Based on original README patch from Frank Li, describe the steps
    to build git with VS2008 (aka MSVC).
    
    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>
  3. @mstormo @gitster

    Add MSVC to Makefile

    mstormo committed with gitster
    Enable MSVC builds with GNU Make by simply calling
        make MSVC=1
    (Debug build possible by adding DEBUG=1 as well)
    
    Two scripts, clink.pl and lib.pl, are used to convert certain GCC
    specific command line options into something MSVC understands.
    By building for MSVC with GNU Make, we can ensure that the MSVC
    port always follows the latest code, and does not lag behind due
    to unmaintained NMake Makefile or IDE projects.
    
    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>
  4. @mstormo @gitster

    Define strncasecmp and ftruncate for MSVC

    mstormo committed with gitster
    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>
  5. @mstormo @gitster

    Make usage of windows.h lean and mean

    mstormo committed with gitster
    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>
  6. @lznuaa @gitster

    Add platform files for porting to MSVC

    lznuaa committed with gitster
    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>
  7. @lznuaa @gitster

    Add MinGW header files to build git with MSVC

    lznuaa committed with gitster
    Added the header files dirent.h, unistd.h and utime.h
    Add alloca.h, which simply includes malloc.h, which defines alloca().
    
    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>
  8. @mstormo @gitster

    Add empty header files for MSVC port

    mstormo committed with gitster
    MSVC lacks many of the header files included by git-compat-util.h; add
    blank header files for these instead of going ifdef crazy.
    
    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>
  9. @lznuaa @gitster

    Test for WIN32 instead of __MINGW32_

    lznuaa committed with gitster
    The code which is conditional on MinGW32 is actually conditional on Windows.
    Use the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,
    but not by Cygwin.
    
    Define SNPRINTF_SIZE_CORR=1 for MSVC too, as its vsnprintf function does
    not add NUL at the end of the buffer if the result fits the buffer size
    exactly.
    
    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>
  10. @lznuaa @gitster

    Fix __stdcall placement and function prototype

    lznuaa committed with gitster
    MSVC requires __stdcall to be between the functions return value and the
    function name, and that the function pointer type is in the form of
    
        return_type (WINAPI *function_name)(arguments...)
    
    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>
  11. @gitster

    Set _O_BINARY as default fmode for both MinGW and MSVC

    Marius Storm-Olsen committed with gitster
    MinGW set the _CRT_fmode to set both the default fmode and _O_BINARY on
    stdin/stdout/stderr. Rather use the main() define in mingw.h to set this
    for both MinGW and MSVC.
    
    This will ensure that a MinGW and MSVC build will handle input and output
    identically.
    
    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>
  12. @lznuaa @gitster

    Change regerror() declaration from K&R style to ANSI C (C89)

    lznuaa committed with gitster
    The MSVC headers typedef errcode as int, and thus confused the compiler in
    the K&R style definition. ANSI style deconfuses it.
    
    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>
  13. @mstormo @gitster

    Add include guards to compat/win32.h

    mstormo committed with gitster
    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>
  14. @lznuaa @gitster

    Avoid declaration after statement

    lznuaa committed with gitster
    MSVC does not understand this C99 style.
    
    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>
Something went wrong with that request. Please try again.