1. 02 10月, 2010 3 次提交
  2. 21 5月, 2010 2 次提交
  3. 12 4月, 2010 1 次提交
  4. 07 3月, 2010 1 次提交
  5. 26 2月, 2010 1 次提交
  6. 17 1月, 2010 3 次提交
    • A
      MSVC: Windows-native implementation for subset of Pthreads API · 44626dc7
      Andrzej K. Haczewski 提交于
      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: NAndrzej K. Haczewski <ahaczewski@gmail.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      44626dc7
    • R
      MSVC: Fix an "incompatible pointer types" compiler warning · b6f714f8
      Ramsay Jones 提交于
      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: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b6f714f8
    • J
      Windows: avoid the "dup dance" when spawning a child process · 75301f90
      Johannes Sixt 提交于
      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: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      75301f90
  7. 24 11月, 2009 1 次提交
  8. 09 11月, 2009 1 次提交
  9. 20 10月, 2009 1 次提交
  10. 19 9月, 2009 2 次提交
  11. 12 9月, 2009 1 次提交
  12. 06 7月, 2009 2 次提交
  13. 01 6月, 2009 1 次提交
    • M
      MinGW readdir reimplementation to support d_type · e16c60d9
      Marius Storm-Olsen 提交于
      The original readdir implementation was fast, but didn't
      support the d_type. This means that git would do additional
      lstats for each entry, to figure out if the entry was a
      directory or not. This unneedingly slowed down many
      operations, since Windows API provides this information
      directly when walking the directories.
      
      By running this implementation on Moe's repo structure:
        mkdir bummer && cd bummer; for ((i=0;i<100;i++)); do
          mkdir $i && pushd $i;
            for ((j=0;j<1000;j++)); do echo "$j" >$j; done;
          popd;
        done
      
      We see the following speedups:
        git add .
        -------------------
        old: 00:00:23(.087)
        new: 00:00:21(.512) 1.07x
      
        git status
        -------------------
        old: 00:00:03(.306)
        new: 00:00:01(.684) 1.96x
      
        git clean -dxf
        -------------------
        old: 00:00:01(.918)
        new: 00:00:00(.295) 6.50x
      Signed-off-by: NMarius Storm-Olsen <marius@trolltech.com>
      Signed-off-by: NSteffen Prohaska <prohaska@zib.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e16c60d9
  14. 23 5月, 2009 2 次提交
  15. 19 3月, 2009 1 次提交
    • J
      MinGW: implement mmap · b130a72b
      Janos 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: NJanos Laube <janos.dev@gmail.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b130a72b
  16. 18 3月, 2009 1 次提交
  17. 08 3月, 2009 1 次提交
  18. 06 3月, 2009 1 次提交
    • J
      MinGW: 64-bit file offsets · 1d4e4cd4
      Johannes Schindelin 提交于
      The type 'off_t' should be used everywhere so that the bit-depth of that
      type can be adjusted in the standard C library, and you just need to
      recompile your program to benefit from the extended precision.
      
      Only that it was not done that way in the MS runtime library.
      
      This patch reroutes off_t to off64_t and provides the other necessary
      changes so that finally, clones larger than 2 gigabyte work on Windows
      (provided you are on a file system that allows files larger than 2gb).
      
      Initial patch by Sickboy <sb@dev-heaven.net>.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Acked-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1d4e4cd4
  19. 22 1月, 2009 1 次提交
  20. 19 8月, 2008 2 次提交
  21. 04 8月, 2008 1 次提交
  22. 26 7月, 2008 1 次提交
  23. 20 7月, 2008 1 次提交
  24. 14 7月, 2008 1 次提交
    • S
      help (Windows): Display HTML in default browser using Windows' shell API · 4804aabc
      Steffen Prohaska 提交于
      The system's default browser for displaying HTML help pages is now used
      directly on Windows, instead of launching git-web--browser, which
      requires a Unix shell.  Avoiding MSYS' bash when possible is good
      because it avoids potential path translation issues.  In this case it is
      not too hard to avoid launching a shell, so let's avoid it.
      
      The Windows-specific code is implemented in compat/mingw.c to avoid
      platform-specific code in the main code base.  On Windows, open_html is
      provided as a define.  If open_html is not defined, git-web--browse is
      used.  This approach avoids platform-specific ifdefs by using
      per-function ifdefs.  The "ifndef open_html" together with the
      introductory comment should sufficiently warn developers, so that they
      hopefully will not break this mechanism.
      Signed-off-by: NSteffen Prohaska <prohaska@zib.de>
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4804aabc
  25. 26 6月, 2008 7 次提交
    • S
      Windows: Fix ntohl() related warnings about printf formatting · cd800eec
      Steffen Prohaska 提交于
      On Windows, ntohl() returns unsigned long.  On Unix it returns
      uint32_t.  This makes choosing a suitable printf format string
      hard.
      
      This commit introduces a mingw specific helper function
      git_ntohl() that casts to unsigned int before returning.  This
      makes gcc's printf format check happy.  It should be safe because
      we expect ntohl to use 32-bit numbers.
      Signed-off-by: NSteffen Prohaska <prohaska@zib.de>
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      cd800eec
    • J
    • J
      Windows: Use a customized struct stat that also has the st_blocks member. · fc2ded5b
      Johannes Sixt 提交于
      Windows's struct stat does not have a st_blocks member. Since we already
      have our own stat/lstat/fstat implementations, we can just as well use
      a customized struct stat. This patch introduces just that, and also fills
      in the st_blocks member. On the other hand, we don't provide members that
      are never used.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      fc2ded5b
    • J
      Windows: Add a custom implementation for utime(). · 7c0ffa1c
      Johannes Sixt 提交于
      This is a necessary pendant to our lstat implementation: MSVCRT's
      implementations of lstat and utime do some adjustments if daylight
      saving time is in effect, but our lstat implementation doesn't do these
      adjustments and report the correct UTC time.  With this implementation
      we omit the adjustments in utime() as well and always write UTC.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      7c0ffa1c
    • M
      Windows: Add a new lstat and fstat implementation based on Win32 API. · 5411bdc4
      Marius Storm-Olsen 提交于
      This gives us a significant speedup when adding, committing and stat'ing files.
      Also, since Windows doesn't really handle symlinks, we let stat just uses lstat.
      We also need to replace fstat, since our implementation and the standard stat()
      functions report slightly different timestamps, possibly due to timezones.
      
      We simply report UTC in our implementation, and do our FILETIME to time_t
      conversion based on the document at http://support.microsoft.com/kb/167296.
      
      With Moe's repo structure (100K files in 100 dirs, containing 2-4 bytes)
          mkdir bummer && cd bummer; for ((i=0;i<100;i++)); do
            mkdir $i && pushd $i;
              for ((j=0;j<1000;j++)); do echo "$j" >$j; done;
            popd;
          done
      
      We get the following performance boost:
      
          With normal lstat & stat  Custom lstat/fstat
          ------------------------  ------------------------
          Command: git init         Command: git init
          ------------------------  ------------------------
          real    0m 0.047s          real   0m 0.063s
          user    0m 0.031s          user   0m 0.015s
          sys     0m 0.000s          sys    0m 0.015s
          ------------------------  ------------------------
          Command: git add .        Command: git add .
          ------------------------  ------------------------
          real    0m19.390s         real    0m12.031s       1.6x
          user    0m 0.015s         user    0m 0.031s
          sys     0m 0.030s         sys     0m 0.000s
          ------------------------  ------------------------
          Command: git commit -a..  Command: git commit -a..
          ------------------------  ------------------------
          real    0m30.812s         real    0m16.875s       1.8x
          user    0m 0.015s         user    0m 0.015s
          sys     0m 0.000s         sys     0m 0.015s
          ------------------------  ------------------------
          3x Command: git-status    3x Command: git-status
          ------------------------  ------------------------
          real    0m11.860s         real    0m 5.266s       2.2x
          user    0m 0.015s         user    0m 0.015s
          sys     0m 0.015s         sys     0m 0.015s
      
          real    0m11.703s         real    0m 5.234s
          user    0m 0.015s         user    0m 0.015s
          sys     0m 0.000s         sys     0m 0.000s
      
          real    0m11.672s         real    0m 5.250s
          user    0m 0.031s         user    0m 0.015s
          sys     0m 0.000s         sys     0m 0.000s
          ------------------------  ------------------------
          Command: git commit...    Command: git commit...
          (single file)             (single file)
          ------------------------  ------------------------
          real    0m14.234s         real    0m 7.735s       1.8x
          user    0m 0.015s         user    0m 0.031s
          sys     0m 0.000s         sys     0m 0.000s
      Signed-off-by: NMarius Storm-Olsen <mstormo_git@storm-olsen.com>
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      5411bdc4
    • J
      Windows: Implement a custom spawnve(). · 7e5d7768
      Johannes Sixt 提交于
      The problem with Windows's own implementation is that it tries to be
      clever when a console program is invoked from a GUI application: In this
      case it sometimes automatically allocates a new console window. As a
      consequence, the IO channels of the spawned program are directed to the
      console, but the invoking application listens on channels that are now
      directed to nowhere.
      
      In this implementation we use the lowlevel facilities of CreateProcess(),
      which offers a flag to tell the system not to open a console. As a side
      effect, only stdin, stdout, and stderr channels will be accessible from
      C programs that are spawned. Other channels (file handles, pipe handles,
      etc.) are still inherited by the spawned program, but it doesn't get
      enough information to access them.
      
      Johannes Schindelin integrated path quoting and unified the various
      *execv* and *spawnv* helpers. Eric Raible suggested to also quote '{'.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      7e5d7768
    • J
      Windows: Implement wrappers for gethostbyname(), socket(), and connect(). · 746fb857
      Johannes Sixt 提交于
      gethostbyname() is the first function that calls into the Winsock library,
      and it is wrapped only to initialize the library.
      
      socket() is wrapped for two reasons:
      - Windows's socket() creates things that are like low-level file handles,
        and they must be converted into file descriptors first.
      - And these handles cannot be used with plain ReadFile()/WriteFile()
        because they are opened for "overlapped IO". We have to use WSASocket()
        to create non-overlapped IO sockets.
      
      connect() must be wrapped because Windows's connect() expects the low-level
      sockets, not file descriptors, and we must first unwrap the file descriptor
      before we can pass it on to Windows's connect().
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      746fb857