1. 27 5月, 2016 1 次提交
    • K
      mingw: make isatty() recognize MSYS2's pseudo terminals (/dev/pty*) · f7f90e0f
      Karsten Blees 提交于
      MSYS2 emulates pseudo terminals via named pipes, and isatty() returns 0
      for such file descriptors. Therefore, some interactive functionality
      (such as launching a pager, asking if a failed unlink should be repeated
      etc.) doesn't work when run in a terminal emulator that uses MSYS2's
      ptys (such as mintty).
      
      However, MSYS2 uses special names for its pty pipes ('msys-*-pty*'),
      which allows us to distinguish them from normal piped input / output.
      
      On startup, check if stdin / stdout / stderr are connected to such pipes
      using the NtQueryObject API from NTDll.dll. If the names match, adjust
      the flags in MSVCRT's ioinfo structure accordingly.
      Signed-off-by: NKarsten Blees <blees@dcon.de>
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f7f90e0f
  2. 22 3月, 2016 1 次提交
  3. 11 3月, 2016 1 次提交
    • J
      sane_grep: pass "-a" if grep accepts it · 71b40103
      Junio C Hamano 提交于
      Newer versions of GNU grep is reported to be pickier when we feed a
      non-ASCII input and break some Porcelain scripts.  As we know we do
      not feed random binary file to our own sane_grep wrapper, allow us
      to always pass "-a" by setting SANE_TEXT_GREP=-a Makefile variable
      to work it around.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      71b40103
  4. 29 2月, 2016 1 次提交
    • T
      config.mak.uname: use clang for Mac OS X 10.6 · 7b6daf8d
      Torsten Bögershausen 提交于
      Gcc under Mac OX 10.6 throws an internal compiler error:
      
      CC combine-diff.o
          combine-diff.c: In function ‘diff_tree_combined’:
          combine-diff.c:1391: internal compiler error: Segmentation fault
      
      while attempting to build Git at 5b442c4f (tree-diff: catch integer
      overflow in combine_diff_path allocation, 2016-02-19).
      
      As clang that ships with the version does not have the same bug,
      make Git compile under Mac OS X 10.6 by using clang instead of gcc
      to work this around, as it is unlikely that we will see fixed GCC
      on that platform.
      
      Later versions of Mac OSX/Xcode only provide clang, and gcc is a
      wrapper to it.
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b6daf8d
  5. 27 1月, 2016 2 次提交
  6. 14 1月, 2016 2 次提交
    • J
      config.mak.uname: supporting 64-bit MSys2 · 7b40ae86
      Johannes Schindelin 提交于
      This just makes things compile, the test suite needs extra tender loving
      care in addition to this change. We will address these issues in later
      commits.
      
      While at it, also allow building MSys2 Git (i.e. a Git that uses MSys2's
      POSIX emulation layer).
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b40ae86
    • J
      config.mak.uname: support MSys2 · df5218b4
      Johannes Schindelin 提交于
      For a long time, Git for Windows lagged behind Git's 2.x releases because
      the Git for Windows developers wanted to let that big jump coincide with
      a well-needed jump away from MSys to MSys2.
      
      To understand why this is such a big issue, it needs to be noted that
      many parts of Git are not written in portable C, but instead Git relies
      on a POSIX shell and Perl to be available.
      
      To support the scripts, Git for Windows has to ship a minimal POSIX
      emulation layer with Bash and Perl thrown in, and when the Git for
      Windows effort started in August 2007, this developer settled on using
      MSys, a stripped down version of Cygwin. Consequently, the original name
      of the project was "msysGit" (which, sadly, caused a *lot* of confusion
      because few Windows users know about MSys, and even less care).
      
      To compile the C code of Git for Windows, MSys was used, too: it sports
      two versions of the GNU C Compiler: one that links implicitly to the
      POSIX emulation layer, and another one that targets the plain Win32 API
      (with a few convenience functions thrown in).  Git for Windows'
      executables are built using the latter, and therefore they are really
      just Win32 programs. To discern executables requiring the POSIX
      emulation layer from the ones that do not, the latter are called MinGW
      (Minimal GNU for Windows) when the former are called MSys executables.
      
      This reliance on MSys incurred challenges, too, though: some of our
      changes to the MSys runtime -- necessary to support Git for Windows
      better -- were not accepted upstream, so we had to maintain our own
      fork. Also, the MSys runtime was not developed further to support e.g.
      UTF-8 or 64-bit, and apart from lacking a package management system
      until much later (when mingw-get was introduced), many packages provided
      by the MSys/MinGW project lag behind the respective source code
      versions, in particular Bash and OpenSSL. For a while, the Git for
      Windows project tried to remedy the situation by trying to build newer
      versions of those packages, but the situation quickly became untenable,
      especially with problems like the Heartbleed bug requiring swift action
      that has nothing to do with developing Git for Windows further.
      
      Happily, in the meantime the MSys2 project (https://msys2.github.io/)
      emerged, and was chosen to be the base of the Git for Windows 2.x. Just
      like MSys, MSys2 is a stripped down version of Cygwin, but it is
      actively kept up-to-date with Cygwin's source code.  Thereby, it already
      supports Unicode internally, and it also offers the 64-bit support that
      we yearned for since the beginning of the Git for Windows project.
      
      MSys2 also ported the Pacman package management system from Arch Linux
      and uses it heavily. This brings the same convenience to which Linux
      users are used to from `yum` or `apt-get`, and to which MacOSX users are
      used to from Homebrew or MacPorts, or BSD users from the Ports system,
      to MSys2: a simple `pacman -Syu` will update all installed packages to
      the newest versions currently available.
      
      MSys2 is also *very* active, typically providing package updates
      multiple times per week.
      
      It still required a two-month effort to bring everything to a state
      where Git's test suite passes, many more months until the first official
      Git for Windows 2.x was released, and a couple of patches still await
      their submission to the respective upstream projects. Yet without MSys2,
      the modernization of Git for Windows would simply not have happened.
      
      This commit lays the ground work to supporting MSys2-based Git builds.
      Assisted-by: NWaldek Maleska <weakcamel@users.github.com>
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      df5218b4
  7. 06 10月, 2015 1 次提交
  8. 08 8月, 2015 1 次提交
  9. 04 6月, 2015 1 次提交
  10. 16 4月, 2015 1 次提交
    • J
      strbuf_getwholeline: use getdelim if it is available · 0cc30e0e
      Jeff King 提交于
      We spend a lot of time in strbuf_getwholeline in a tight
      loop reading characters from a stdio handle into a buffer.
      The libc getdelim() function can do this for us with less
      overhead. It's in POSIX.1-2008, and was a GNU extension
      before that. Therefore we can't rely on it, but can fall
      back to the existing getc loop when it is not available.
      
      The HAVE_GETDELIM knob is turned on automatically for Linux,
      where we have glibc. We don't need to set any new
      feature-test macros, because we already define _GNU_SOURCE.
      Other systems that implement getdelim may need to other
      macros (probably _POSIX_C_SOURCE >= 200809L), but we can
      address that along with setting the Makefile knob after
      testing the feature on those systems.
      
      Running "git rev-parse refs/heads/does-not-exist" on a repo
      with an extremely large (1.6GB) packed-refs file went from
      (best-of-5):
      
        real    0m8.601s
        user    0m8.084s
        sys     0m0.524s
      
      to:
      
        real    0m6.768s
        user    0m6.340s
        sys     0m0.432s
      
      for a wall-clock speedup of 21%.
      
      Based on a patch from Rasmus Villemoes <rv@rasmusvillemoes.dk>.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0cc30e0e
  11. 11 3月, 2015 1 次提交
  12. 10 1月, 2015 1 次提交
  13. 18 12月, 2014 2 次提交
    • J
      read-cache: optionally disallow NTFS .git variants · 2b4c6efc
      Johannes Schindelin 提交于
      The point of disallowing ".git" in the index is that we
      would never want to accidentally overwrite files in the
      repository directory. But this means we need to respect the
      filesystem's idea of when two paths are equal. The prior
      commit added a helper to make such a comparison for NTFS
      and FAT32; let's use it in verify_path().
      
      We make this check optional for two reasons:
      
        1. It restricts the set of allowable filenames, which is
           unnecessary for people who are not on NTFS nor FAT32.
           In practice this probably doesn't matter, though, as
           the restricted names are rather obscure and almost
           certainly would never come up in practice.
      
        2. It has a minor performance penalty for every path we
           insert into the index.
      
      This patch ties the check to the core.protectNTFS config
      option. Though this is expected to be most useful on Windows,
      we allow it to be set everywhere, as NTFS may be mounted on
      other platforms. The variable does default to on for Windows,
      though.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2b4c6efc
    • J
      read-cache: optionally disallow HFS+ .git variants · a42643aa
      Jeff King 提交于
      The point of disallowing ".git" in the index is that we
      would never want to accidentally overwrite files in the
      repository directory. But this means we need to respect the
      filesystem's idea of when two paths are equal. The prior
      commit added a helper to make such a comparison for HFS+;
      let's use it in verify_path.
      
      We make this check optional for two reasons:
      
        1. It restricts the set of allowable filenames, which is
           unnecessary for people who are not on HFS+. In practice
           this probably doesn't matter, though, as the restricted
           names are rather obscure and almost certainly would
           never come up in practice.
      
        2. It has a minor performance penalty for every path we
           insert into the index.
      
      This patch ties the check to the core.protectHFS config
      option. Though this is expected to be most useful on OS X,
      we allow it to be set everywhere, as HFS+ may be mounted on
      other platforms. The variable does default to on for OS X,
      though.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a42643aa
  14. 16 8月, 2014 2 次提交
  15. 22 7月, 2014 1 次提交
  16. 14 7月, 2014 1 次提交
    • K
      trace: add high resolution timer function to debug performance issues · 148d6771
      Karsten Blees 提交于
      Add a getnanotime() function that returns nanoseconds since 01/01/1970 as
      unsigned 64-bit integer (i.e. overflows in july 2554). This is easier to
      work with than e.g. struct timeval or struct timespec. Basing the timer on
      the epoch allows using the results with other time-related APIs.
      
      To simplify adaption to different platforms, split the implementation into
      a common getnanotime() and a platform-specific highres_nanos() function.
      
      The common getnanotime() function handles errors, falling back to
      gettimeofday() if highres_nanos() isn't implemented or doesn't work.
      
      getnanotime() is also responsible for normalizing to the epoch. The offset
      to the system clock is calculated only once on initialization, i.e.
      manually setting the system clock has no impact on the timer (except if
      the fallback gettimeofday() is in use). Git processes are typically short
      lived, so we don't need to handle clock drift.
      
      The highres_nanos() function returns monotonically increasing nanoseconds
      relative to some arbitrary point in time (e.g. system boot), or 0 on
      failure. Providing platform-specific implementations should be relatively
      easy, e.g. adapting to clock_gettime() as defined by the POSIX realtime
      extensions is seven lines of code.
      
      This version includes highres_nanos() implementations for:
       * Linux: using clock_gettime(CLOCK_MONOTONIC)
       * Windows: using QueryPerformanceCounter()
      
      Todo:
       * enable clock_gettime() on more platforms
       * add Mac OSX version, e.g. using mach_absolute_time + mach_timebase_info
      Signed-off-by: NKarsten Blees <blees@dcon.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      148d6771
  17. 10 6月, 2014 1 次提交
  18. 07 5月, 2014 1 次提交
  19. 17 4月, 2014 1 次提交
    • N
      index-pack: work around thread-unsafe pread() · 39539495
      Nguyễn Thái Ngọc Duy 提交于
      Multi-threaing of index-pack was disabled with c0f86547
      (index-pack: Disable threading on cygwin - 2012-06-26), because
      pread() implementations for Cygwin and MSYS were not thread
      safe.  Recent Cygwin does offer usable pread() and we enabled
      multi-threading with 103d530f (Cygwin 1.7 has thread-safe pread,
      2013-07-19).
      
      Work around this problem on platforms with a thread-unsafe
      pread() emulation by opening one file handle per thread; it
      would prevent parallel pread() on different file handles from
      stepping on each other.
      
      Also remove NO_THREAD_SAFE_PREAD that was introduced in c0f86547
      because it's no longer used anywhere.
      
      This workaround is unconditional, even for platforms with
      thread-safe pread() because the overhead is small (a couple file
      handles more) and not worth fragmenting the code.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Tested-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      39539495
  20. 10 4月, 2014 1 次提交
    • K
      mingw: activate alloca · 22f4c27e
      Kirill Smelkov 提交于
      Both MSVC and MINGW have alloca(3) definitions in malloc.h, so by moving
      win32-compat alloca.h from compat/vcbuild/include/ to compat/win32/ ,
      which is included by both MSVC and MINGW CFLAGS, we can make alloca()
      work on both those Windows environments.
      
      In MINGW, malloc.h has explicit check for GNUC and if it is so, defines
      alloca to __builtin_alloca, so it looks like we don't need to add any
      code to here-shipped alloca.h to get optimum performance.
      
      Compile-tested on Windows in MSysGit.
      Signed-off-by: NKirill Smelkov <kirr@mns.spb.ru>
      Acked-by: NErik Faye-Lund <kusmabite@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      22f4c27e
  21. 05 4月, 2014 1 次提交
  22. 02 4月, 2014 1 次提交
  23. 29 3月, 2014 1 次提交
  24. 28 3月, 2014 2 次提交
    • M
      MSVC: allow linking with the cURL library · da8daa36
      Marat Radchenko 提交于
      Teach the clink.pl script that -lcurl is a request to link with the
      cURL library, and drop NO_CURL from config.mak.uname for the MSVC
      platform.
      Signed-off-by: NMarat Radchenko <marat@slonopotamus.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      da8daa36
    • K
      Portable alloca for Git · 61f76a36
      Kirill Smelkov 提交于
      In the next patch we'll have to use alloca() for performance reasons,
      but since alloca is non-standardized and is not portable, let's have a
      trick with compatibility wrappers:
      
      1. at configure time, determine, do we have working alloca() through
         alloca.h, and define
      
          #define HAVE_ALLOCA_H
      
         if yes.
      
      2. in code
      
          #ifdef HAVE_ALLOCA_H
          # include <alloca.h>
          # define xalloca(size)      (alloca(size))
          # define xalloca_free(p)    do {} while(0)
          #else
          # define xalloca(size)      (xmalloc(size))
          # define xalloca_free(p)    (free(p))
          #endif
      
         and use it like
      
         func() {
             p = xalloca(size);
             ...
      
             xalloca_free(p);
         }
      
      This way, for systems, where alloca is available, we'll have optimal
      on-stack allocations with fast executions. On the other hand, on
      systems, where alloca is not available, this gracefully fallbacks to
      xmalloc/free.
      
      Both autoconf and config.mak.uname configurations were updated. For
      autoconf, we are not bothering considering cases, when no alloca.h is
      available, but alloca() works some other way - its simply alloca.h is
      available and works or not, everything else is deep legacy.
      
      For config.mak.uname, I've tried to make my almost-sure guess for where
      alloca() is available, but since I only have access to Linux it is the
      only change I can be sure about myself, with relevant to other changed
      systems people Cc'ed.
      
      NOTE
      
      SunOS and Windows had explicit -DHAVE_ALLOCA_H in their configurations.
      I've changed that to now-common HAVE_ALLOCA_H=YesPlease which should be
      correct.
      
      Cc: Brandon Casey <drafnel@gmail.com>
      Cc: Marius Storm-Olsen <mstormo@gmail.com>
      Cc: Johannes Sixt <j6t@kdbg.org>
      Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
      Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Cc: Gerrit Pape <pape@smarden.org>
      Cc: Petr Salinger <Petr.Salinger@seznam.cz>
      Cc: Jonathan Nieder <jrnieder@gmail.com>
      Acked-by: Thomas Schwinge <thomas@codesourcery.com> (GNU Hurd changes)
      Signed-off-by: NKirill Smelkov <kirr@mns.spb.ru>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      61f76a36
  25. 21 2月, 2014 1 次提交
  26. 03 1月, 2014 1 次提交
  27. 12 9月, 2013 2 次提交
  28. 21 8月, 2013 1 次提交
  29. 22 7月, 2013 4 次提交
  30. 19 7月, 2013 1 次提交
  31. 04 6月, 2013 1 次提交