1. 03 Mar, 2009 1 commit
    • René Scharfe's avatar
      diffcore-pickaxe: use memmem() · ce163c79
      René Scharfe authored
      Use memmem() instead of open-coding it.  The system libraries usually have a
      much faster version than the memcmp()-loop here.  Even our own fall-back in
      compat/, which is used on Windows, is slightly faster.
      The following commands were run in a Linux kernel repository and timed, the
      best of five results is shown:
        $ STRING='Ensure that the real time constraints are schedulable.'
        $ git log -S"$STRING" HEAD -- kernel/sched.c >/dev/null
      On Ubuntu 8.10 x64, before (v1.6.2-rc2):
        8.09user 0.04system 0:08.14elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+30952minor)pagefaults 0swaps
      And with the patch:
        1.50user 0.04system 0:01.54elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+30645minor)pagefaults 0swaps
      On Fedora 10 x64, before:
        8.34user 0.05system 0:08.39elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+29268minor)pagefaults 0swaps
      And with the patch:
        1.15user 0.05system 0:01.20elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+32253minor)pagefaults 0swaps
      On Windows Vista x64, before:
        real    0m9.204s
        user    0m0.000s
        sys     0m0.000s
      And with the patch:
        real    0m8.470s
        user    0m0.000s
        sys     0m0.000s
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
  2. 07 Jun, 2007 1 commit
    • Junio C Hamano's avatar
      War on whitespace · a6080a0a
      Junio C Hamano authored
      This uses "git-apply --whitespace=strip" to fix whitespace errors that have
      crept in to our source files over time.  There are a few files that need
      to have trailing whitespaces (most notably, test vectors).  The results
      still passes the test, and build result in Documentation/ area is unchanged.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
  3. 07 May, 2007 1 commit
  4. 26 Jan, 2007 1 commit
    • Jeff King's avatar
      diffcore-pickaxe: fix infinite loop on zero-length needle · e1b16116
      Jeff King authored
      The "contains" algorithm runs into an infinite loop if the needle string
      has zero length. The loop could be modified to handle this, but it makes
      more sense to simply have an empty needle return no matches. Thus, a
      command like
        git log -S
      produces no output.
      We place the check at the top of the function so that we get the same
      results with or without --pickaxe-regex. Note that until now,
        git log -S --pickaxe-regex
      would match everything, not nothing.
      Arguably, an empty pickaxe string should simply produce an error
      message; however, this is still a useful assertion to add to the
      algorithm at this layer of the code.
      Noticed by Bill Lear.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
  5. 20 Dec, 2006 1 commit
    • Junio C Hamano's avatar
      simplify inclusion of system header files. · 85023577
      Junio C Hamano authored
      This is a mechanical clean-up of the way *.c files include
      system header files.
       (1) sources under compat/, platform sha-1 implementations, and
           xdelta code are exempt from the following rules;
       (2) the first #include must be "git-compat-util.h" or one of
           our own header file that includes it first (e.g. config.h,
           builtin.h, pkt-line.h);
       (3) system headers that are included in "git-compat-util.h"
           need not be included in individual C source files.
       (4) "git-compat-util.h" does not have to include subsystem
           specific header files (e.g. expat.h).
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
  6. 05 Apr, 2006 1 commit
  7. 04 Apr, 2006 1 commit
    • Petr Baudis's avatar
      Support for pickaxe matching regular expressions · d01d8c67
      Petr Baudis authored
      git-diff-* --pickaxe-regex will change the -S pickaxe to match
      POSIX extended regular expressions instead of fixed strings.
      The regex.h library is a rather stupid interface and I like pcre too, but
      with any luck it will be everywhere we will want to run Git on, it being
      POSIX.2 and all. I'm not sure if we can expect platforms like AIX to
      conform to POSIX.2 or if win32 has regex.h. We might add a flag to
      Makefile if there is a portability trouble potential.
      Signed-off-by: default avatarPetr Baudis <pasky@suse.cz>
  8. 24 Jul, 2005 1 commit
  9. 29 May, 2005 4 commits
  10. 23 May, 2005 2 commits
    • Junio C Hamano's avatar
      [PATCH] Performance fix for pickaxe. · 046aa644
      Junio C Hamano authored
      The pickaxe was expanding the blobs and searching in them even
      when it should have already known that both sides are the same.
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    • Junio C Hamano's avatar
      [PATCH] Rename/copy detection fix. · f7c1512a
      Junio C Hamano authored
      The rename/copy detection logic in earlier round was only good
      enough to show patch output and discussion on the mailing list
      about the diff-raw format updates revealed many problems with
      it.  This patch fixes all the ones known to me, without making
      things I want to do later impossible, mostly related to patch
       (1) Earlier rename/copy detector determined which one is rename
           and which one is copy too early, which made it impossible
           to later introduce diffcore transformers to reorder
           patches.  This patch fixes it by moving that logic to the
           very end of the processing.
       (2) Earlier output routine diff_flush() was pruning all the
           "no-change" entries indiscriminatingly.  This was done due
           to my false assumption that one of the requirements in the
           diff-raw output was not to show such an entry (which
           resulted in my incorrect comment about "diff-helper never
           being able to be equivalent to built-in diff driver").  My
           special thanks go to Linus for correcting me about this.
           When we produce diff-raw output, for the downstream to be
           able to tell renames from copies, sometimes it _is_
           necessary to output "no-change" entries, and this patch
           adds diffcore_prune() function for doing it.
       (3) Earlier diff_filepair structure was trying to be not too
           specific about rename/copy operations, but the purpose of
           the structure was to record one or two paths, which _was_
           indeed about rename/copy.  This patch discards xfrm_msg
           field which was trying to be generic for this wrong reason,
           and introduces a couple of fields (rename_score and
           rename_rank) that are explicitly specific to rename/copy
           logic.  One thing to note is that the information in a
           single diff_filepair structure _still_ does not distinguish
           renames from copies, and it is deliberately so.  This is to
           allow patches to be reordered in later stages.
       (4) This patch also adds some tests about diff-raw format
           output and makes sure that necessary "no-change" entries
           appear on the output.
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
  11. 22 May, 2005 3 commits
  12. 21 May, 2005 1 commit
    • Junio C Hamano's avatar
      [PATCH] Introducing software archaeologist's tool "pickaxe". · 52e95789
      Junio C Hamano authored
      This steals the "pickaxe" feature from JIT and make it available
      to the bare Plumbing layer.  From the command line, the user
      gives a string he is intersted in.
      Using the diff-core infrastructure previously introduced, it
      filters the differences to limit the output only to the diffs
      between <src> and <dst> where the string appears only in one but
      not in the other.  For example:
       $ ./git-rev-list HEAD | ./git-diff-tree -Sdiff-tree-helper --stdin -M
      would show the diffs that touch the string "diff-tree-helper".
      In real software-archaeologist application, you would typically
      look for a few to several lines of code and see where that code
      came from.
      The "pickaxe" module runs after "rename/copy detection" module,
      so it even crosses the file rename boundary, as the above
      example demonstrates.
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>