Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Jun 9, 2013
  1. Win32: add a cache below mingw's lstat and readdir implementations

    Checking the work tree status is quite slow on Windows, due to slow lstat
    emulation (git calls lstat once for each file in the index). Windows
    operating system APIs seem to be much better at scanning the status
    of entire directories than checking single files.
    Add an lstat implementation that uses a cache for lstat data. Cache misses
    read the entire parent directory and add it to the cache. Subsequent lstat
    calls for the same directory are served directly from the cache.
    Also implement opendir / readdir / closedir so that they create and use
    directory listings in the cache.
    The cache doesn't track file system changes and doesn't plug into any
    modifying file APIs, so it has to be explicitly enabled for git functions
    that don't modify the working copy. For a start, enable the cache for the
    entire 'git status' command and the core.preloadIndex feature.
    The cache can be disabled at runtime by setting environment variable
    GIT_NOFSCACHE, or at compile time by unsetting USE_FSCACHE in the Makefile.
    Note: in an earlier version of this patch, the cache was always active and
    tracked file system changes via ReadDirectoryChangesW. However, this was
    much more complex and had negative impact on the performance of modifying
    git commands such as 'git checkout'.
    Signed-off-by: Karsten Blees <>
  2. add a hashtable implementation that supports O(1) removal

    The existing hashtable implementation (in hash.[ch]) uses open addressing
    (i.e. resolve hash collisions by distributing entries across the table).
    Thus, removal is difficult to implement with less than O(n) complexity.
    Resolving collisions of entries with identical hashes (e.g. via chaining)
    is left to the client code.
    Add a hashtable implementation that supports O(1) removal and is slightly
    easier to use due to builtin entry chaining.
    Supports all basic operations init, free, get, put, remove and iteration.
    Also includes ready-to-use hash functions based on the public domain FNV-1
    algorithm (
    The per-entry data structure (hashmap_entry) is meant to be piggybacked
    onto the client's data structure to save memory. See test-hashmap.c for
    usage examples.
    The hashtable is resized by a factor of four when 80% full. With these
    settings, average memory consumption is about 2/3 of hash.[ch], and
    insertion is twice as fast (due to less frequent resizing).
    Signed-off-by: Karsten Blees <>
  3. Win32: fix segfault in WriteConsoleW when debugging in gdb

    On Windows XP (not Win7), WriteConsoleW and WriteFile seem to raise and
    catch SIGSEGV if the lpNumberOfCharsWritten parameter is NULL. This is not
    a problem when executed standalone, but gdb stops execution here (unless
    disabled via "handle SIGSEGV nostop").
    Fix it by passing a dummy variable.
    Signed-off-by: Karsten Blees <>
Commits on Jun 7, 2013
  1. Win32: add command performance tracing to debug scripted commands

    Especially scripted git commands are still quite slow on Windows. Add
    performance tracing to identify which commands are called by a script and
    how long they execute.
    Usage: > GIT_TRACE_PERFORMANCE=C:/git.log git svn rebase
    creates a log file like this:
    trace: at compat/mingw.c:2068, time: 0.001000 s: command: git.exe rev-parse --show-prefix
    trace: at compat/mingw.c:2068, time: 0.001219 s: command: git.exe config --bool --get svn.fetchall
    Signed-off-by: Karsten Blees <>
  2. Win32: add trace_performance facility to debug performance issues

    Add trace_performance and trace_performance_since macros that print file
    name, line number, time and an optional printf-formatted text to the file
    specified in environment variable GIT_TRACE_PERFORMANCE.
    Unless enabled via GIT_TRACE_PERFORMANCE, these macros have no noticeable
    impact on performance, so that test code may be shipped in release builds.
    MSVC: variadic macros (__VA_ARGS__) require VC++ 2005 or newer.
    Simple use case (measure one code section):
    doube start = ticks();
    /* measure this */
    trace_performance_since(start, "foobar");
    Medium use case (measure consecutive code sections):
    doube start = ticks();
    /* measure this */
    start = trace_performance_since(start, "foobar1");
    /* measure this */
    trace_performance_since(start, "foobar2");
    Complex use case (measure several code sections):
    double t = 0;
    for (;;) {
      /* ignore */
      t -= ticks();
      /* measure this */
      t += ticks();
      /* ignore */
    trace_performance(t, "frotz");
    Signed-off-by: Karsten Blees <>
  3. Win32: add high resolution timer function to debug performance issues

    Add a high resolution timer function as basis for performance debugging.
    Simple use case (measure one code section):
    doube start = ticks();
    /* measure this */
    fprintf(stderr, "time: %g s\n", (ticks() - start));
    Complex use case (measure several code sections):
    double t = 0;
    for (;;) {
      /* ignore */
      t -= ticks();
      /* measure this */
      t += ticks();
      /* ignore */
    fprintf(stderr, "time: %g s\n", t);
    Signed-off-by: Karsten Blees <>
Commits on Jun 1, 2013
  1. @patthoyts

    t4210: skip command-line encoding tests on mingw

    patthoyts committed
    On Windows the application command line is provided as unicode and in
    mingw-git we convert that to utf-8. So these tests that require a iso-8859-1
    input are being subverted by the encoding transformations we perform and
    should be skipped.
    Signed-off-by: Pat Thoyts <>
Commits on May 31, 2013
  1. @patthoyts

    t7800: a few tests should ignore crlf in checking the result.

    patthoyts committed
    Those tests that generate files using echo can expect crlf issues when run
    under windows. For such cases we use 'test_cmp_text'.
    Signed-off-by: Pat Thoyts <>
Commits on May 30, 2013
  1. @patthoyts

    dir.c: fix ignore processing within not-ignored directories

    committed with patthoyts
    As of 95c6f27 "dir.c: unify is_excluded and is_path_excluded APIs", the
    is_excluded API no longer recurses into directories that match an ignore
    pattern, and returns the directory's ignored state for all contained paths.
    This is OK for normal ignore patterns, i.e. ignoring a directory affects
    the entire contents recursively.
    Unfortunately, this also "works" for negated ignore patterns ('!dir'), i.e.
    the entire contents is "not-ignored" recursively, regardless of ignore
    patterns that match the contents directly.
    In prep_exclude, skip recursing into a directory only if it is really
    ignored (i.e. the ignore pattern is not negated).
    Signed-off-by: Karsten Blees <>
    Tested-by: Øystein Walle
    Signed-off-by: Junio C Hamano <>
  2. @patthoyts

    t0008: avoid absolute path on Windows as colon is used in the tests

    patthoyts committed
    The test separator char is a colon which means any absolute paths on windows
    confuse the tests that use global_excludes.
    Suggested-by: Karsten Blees <>
    Signed-off-by: Pat Thoyts <>
Commits on May 29, 2013
  1. @dscho @patthoyts

    Fix t3404 for Windows

    dscho committed with patthoyts
    The usual problem: CR/LF...
    Signed-off-by: Johannes Schindelin <>
  2. @Grahack @patthoyts
  3. @patthoyts

    wincred: add install target and avoid overwriting configured variables.

    patthoyts committed
    Signed-off-by: Pat Thoyts <>
  4. @patthoyts

    t1306: perform file comparisons using text mode for Windows support

    patthoyts committed
    Signed-off-by: Pat Thoyts <>
  5. @dscho @patthoyts

    git stash: make sure that .git/logs/refs/ exists

    dscho committed with patthoyts
    If the user has not activated reflogs, or if nothing has been recorded
    yet (as is the case directly after cloning), said directory may not
    exist yet.
    Signed-off-by: Johannes Schindelin <>
  6. @sschuberth @patthoyts

    gitk: Use an external icon file on Windows

    sschuberth committed with patthoyts
    Git for Windows now ships with the new Git icon from Use that
    icon file if it exists instead of the old procedurally drawn one.
    This patch was sent upstream but so far no decision on its inclusion was
    made, so commit it to our fork.
    Signed-off-by: Sebastian Schuberth <>
  7. @patthoyts

    help: correct behavior for is_executable on Windows

    Heiko Voigt committed with patthoyts
    The previous implementation said that the filesystem information on
    Windows is not reliable to determine whether a file is executable.
    To find gather this information it was peeking into the first two bytes
    of a file to see whether it looks executable.
    Apart from the fact that on Windows executables are usually defined as
    such by their extension it lead to slow opening of help file in some
    When you have virus scanner running calling open on an executable file
    is a potentially expensive operation. See the following measurements (in
    seconds) for example.
    With virus scanner running (coldcache):
    $ ./a.exe /libexec/git-core/
    before open (git-add.exe): 0.000000
    after open (git-add.exe): 0.412873
    before open (git-annotate.exe): 0.000175
    after open (git-annotate.exe): 0.397925
    before open (git-apply.exe): 0.000243
    after open (git-apply.exe): 0.399996
    before open (git-archive.exe): 0.000147
    after open (git-archive.exe): 0.397783
    before open (git-bisect--helper.exe): 0.000160
    after open (git-bisect--helper.exe): 0.397700
    before open (git-blame.exe): 0.000160
    after open (git-blame.exe): 0.399136
    With virus scanner running (hotcache):
    $ ./a.exe /libexec/git-core/
    before open (git-add.exe): 0.000000
    after open (git-add.exe): 0.000325
    before open (git-annotate.exe): 0.000229
    after open (git-annotate.exe): 0.000177
    before open (git-apply.exe): 0.000167
    after open (git-apply.exe): 0.000150
    before open (git-archive.exe): 0.000154
    after open (git-archive.exe): 0.000156
    before open (git-bisect--helper.exe): 0.000132
    after open (git-bisect--helper.exe): 0.000180
    before open (git-blame.exe): 0.000718
    after open (git-blame.exe): 0.000724
    This test did just list the given directory and open() each file in it.
    With this patch I get:
    $ time git help git
    Launching default browser to display HTML ...
    real    0m8.723s
    user    0m0.000s
    sys     0m0.000s
    and without
    $ time git help git
    Launching default browser to display HTML ...
    real    1m37.734s
    user    0m0.000s
    sys     0m0.031s
    both tests with cold cache and giving the machine some time to settle
    down after restart.
    Signed-off-by: Heiko Voigt <>
  8. @patthoyts

    Set the default help format to html for msys builds.

    patthoyts committed
    This resolves issue #19 by setting the compiled default to html in msys
    builds following the changes introduced by commit
    1cc8af0 "help: use HTML as the default help format on Windows"
    Signed-off-by: Pat Thoyts <>
  9. @aroben @patthoyts

    Make non-.exe externals work again

    aroben committed with patthoyts
    7ebac8c made launching of .exe
    externals work when installed in Unicode paths. But it broke launching
    of non-.exe externals, no matter where they were installed. We now
    correctly maintain the UTF-8 and UTF-16 paths in tandem in lookup_prog.
    This fixes t5526, among others.
    Signed-off-by: Adam Roben <>
  10. @patthoyts

    Ensure the resource file is rebuilt when the version changes.

    patthoyts committed
    Acked-by: Erik Faye-Lund <>
    Acked-by: Johannes Schindelin <>
    Signed-off-by: Pat Thoyts <>
  11. @dscho @patthoyts

    Windows resource: handle dashes in the Git version gracefully

    dscho committed with patthoyts
    Reported by postiffm as issue #14.
    Signed-off-by: Johannes Schindelin <>
  12. @patthoyts

    Provide a Windows version resource for the git executables.

    patthoyts committed
    Embeds the git version and description into the git executable thus
    implementing the request in issue #5.
    Acked-by: Heiko Voigt <>
    Acked-by: Sebastian Schuberth <>
    Acked-by: Johannes Schindelin <>
    Signed-off-by: Pat Thoyts <>
  13. @theoleblond @patthoyts

    Sleep 1 millisecond in poll() to avoid busy wait

    theoleblond committed with patthoyts
    I played around with this quite a bit. After trying some more complex
    schemes, I found that what worked best is to just sleep 1 millisecond
    between iterations. Though it's a very short time, it still completely
    eliminates the busy wait condition, without hurting perf.
    There code uses SleepEx(1, TRUE) to sleep. See this page for a good
    discussion of why that is better than calling SwitchToThread, which
    is what was used previously:
    Note that calling SleepEx(0, TRUE) does *not* solve the busy wait.
    The most striking case was when testing on a UNC share with a large repo,
    on a single CPU machine. Without the fix, it took 4 minutes 15 seconds,
    and with the fix it took just 1:08! I think it's because git-upload-pack's
    busy wait was eating the CPU away from the git process that's doing the
    real work. With multi-proc, the timing is not much different, but tons of
    CPU time is still wasted, which can be a killer on a server that needs to
    do bunch of other things.
    I also tested the very fast local case, and didn't see any measurable
    difference. On a big repo with 4500 files, the upload-pack took about 2
    seconds with and without the fix.
  14. @dscho @patthoyts

    Work around a problem identified by BuildHive

    dscho committed with patthoyts
    Apparently the signal handling is not quite correct in the fsckobject
    handling (most likely we rely on a side effect that lets us still output
    some message after receiving a signal 13 but in the BuildHive setup this
    fails intermittently).
    As a consequence, the push in t5504 does fail as expected, but fails to
    output anything (unexpected). Since this is good enough for now, let's
    handle an empty output as success, too.
    Signed-off-by: Johannes Schindelin <>
  15. @dscho @patthoyts

    t1050: Fix invalid call to dd(1)

    dscho committed with patthoyts
    This is a companion patch to fce52b4(t4012: Fix invalid call to dd(1)).
    Signed-off-by: Johannes Schindelin <>
  16. @dscho @patthoyts

    Always auto-gc after calling a fast-import transport

    dscho committed with patthoyts
    After importing anything with fast-import, we should always let the
    garbage collector do its job, since the objects are written to disk
    This brings down an initial import of from about
    230 megabytes to about 14.
    In the future, we may want to make this configurable on a per-remote
    basis, or maybe teach fast-import about it in the first place.
    Signed-off-by: Johannes Schindelin <>
  17. @SRabbelier @patthoyts

    remote-helper: check helper status after import/export

    SRabbelier committed with patthoyts
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Sverre Rabbelier <>
  18. @SRabbelier @patthoyts

    transport-helper: add trailing --

    SRabbelier committed with patthoyts
    [PT: ensure we add an additional element to the argv array]
  19. @SRabbelier @patthoyts

    t5800: point out that deleting branches does not work

    SRabbelier committed with patthoyts
    This test actually breaks the repositories involved somehow, so it is
    not enabled by default.
  20. @SRabbelier @patthoyts

    t5800: test pushing a new branch with old content

    SRabbelier committed with patthoyts
    This works now that fast-export has been fixed to properly handle
    refs that point to a commit that was not exported during the current
    fast-export run.
  21. @dscho @patthoyts

    setup_revisions: remember whether a ref was positive or not

    dscho committed with patthoyts
    This will be required by fast-export, when no commits were
    exported, but the refs should be set, of course.
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Sverre Rabbelier <>
  22. @dscho @patthoyts

    fast-export: do not refer to non-existing marks

    dscho committed with patthoyts
    When calling `git fast-export a..a b` when a and b refer to the same
    commit, nothing would be exported, and an incorrect reset line would
    be printed for b ('from :0').
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Sverre Rabbelier <>
  23. @kusma @patthoyts

    MSVC: fix poll-related macro redefines

    kusma committed with patthoyts
    This seems to be related to the poll-emulation... I see that these things
    are guarded by an "#if(_WIN32_WINNT >= 0x0600)" in <winsock2.h>, which
    means it's supported for Windows Vista and above... We still support
    Windows XP, so it seems someone has set this too high :)
    I'd prefer to set this from the Makefile, but this generates a warning in
    compat/win32/poll.c about redefining a macro (poll.c wants it to be 0x502,
    which is Windows XP with SP2, rather than 0x501 which is normal Windows
    [PT: amended to follow 41f2999 "msvc: Fix compilation errors caused by
         poll.h emulation" and support both MSVC and mingw]
    Signed-off-by: Johannes Schindelin <>
Something went wrong with that request. Please try again.