1. 12 8月, 2010 1 次提交
  2. 15 7月, 2009 1 次提交
  3. 26 5月, 2009 2 次提交
    • J
      Optimize "diff-index --cached" using cache-tree · b65982b6
      Junio C Hamano 提交于
      When running "diff-index --cached" after making a change to only a small
      portion of the index, there is no point unpacking unchanged subtrees into
      the index recursively, only to find that all entries match anyway.  Tweak
      unpack_trees() logic that is used to read in the tree object to catch the
      case where the tree entry we are looking at matches the index as a whole
      by looking at the cache-tree.
      
      As an exercise, after modifying a few paths in the kernel tree, here are
      a few numbers on my Athlon 64X2 3800+:
      
          (without patch, hot cache)
          $ /usr/bin/time git diff --cached --raw
          :100644 100644 b57e1f5... e69de29... M  Makefile
          :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
          :000000 100644 0000000... e69de29... A  arche
          0.07user 0.02system 0:00.09elapsed 102%CPU (0avgtext+0avgdata 0maxresident)k
          0inputs+0outputs (0major+9407minor)pagefaults 0swaps
      
          (with patch, hot cache)
          $ /usr/bin/time ../git.git/git-diff --cached --raw
          :100644 100644 b57e1f5... e69de29... M  Makefile
          :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
          :000000 100644 0000000... e69de29... A  arche
          0.02user 0.00system 0:00.02elapsed 103%CPU (0avgtext+0avgdata 0maxresident)k
          0inputs+0outputs (0major+2446minor)pagefaults 0swaps
      
      Cold cache numbers are very impressive, but it does not matter very much
      in practice:
      
          (without patch, cold cache)
          $ su root sh -c 'echo 3 >/proc/sys/vm/drop_caches'
          $ /usr/bin/time git diff --cached --raw
          :100644 100644 b57e1f5... e69de29... M  Makefile
          :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
          :000000 100644 0000000... e69de29... A  arche
          0.06user 0.17system 0:10.26elapsed 2%CPU (0avgtext+0avgdata 0maxresident)k
          247032inputs+0outputs (1172major+8237minor)pagefaults 0swaps
      
          (with patch, cold cache)
          $ su root sh -c 'echo 3 >/proc/sys/vm/drop_caches'
          $ /usr/bin/time ../git.git/git-diff --cached --raw
          :100644 100644 b57e1f5... e69de29... M  Makefile
          :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
          :000000 100644 0000000... e69de29... A  arche
          0.02user 0.01system 0:01.01elapsed 3%CPU (0avgtext+0avgdata 0maxresident)k
          18440inputs+0outputs (79major+2369minor)pagefaults 0swaps
      
      This of course helps "git status" as well.
      
          (without patch, hot cache)
          $ /usr/bin/time ../git.git/git-status >/dev/null
          0.17user 0.18system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
          0inputs+5336outputs (0major+10970minor)pagefaults 0swaps
      
          (with patch, hot cache)
          $ /usr/bin/time ../git.git/git-status >/dev/null
          0.10user 0.16system 0:00.27elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
          0inputs+5336outputs (0major+3921minor)pagefaults 0swaps
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b65982b6
    • J
      cache-tree.c::cache_tree_find(): simplify internal API · b87fc964
      Junio C Hamano 提交于
      Earlier cache_tree_find() needs to be called with a valid cache_tree,
      but repeated look-up may find an invalid or missing cache_tree in between.
      Help simplify the callers by returning NULL to mean "nothing appropriate
      found" when the input is NULL.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b87fc964
  4. 21 5月, 2009 1 次提交
    • J
      write-tree --ignore-cache-tree · d11b8d34
      Junio C Hamano 提交于
      This allows you to discard the cache-tree information before writing the
      tree out of the index (i.e. it always recomputes the tree object names for
      all the subtrees).
      
      This is only useful as a debug option, so I did not bother documenting it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d11b8d34
  5. 20 4月, 2009 1 次提交
  6. 01 12月, 2008 1 次提交
  7. 16 7月, 2008 1 次提交
  8. 24 4月, 2008 1 次提交
  9. 05 2月, 2008 1 次提交
  10. 22 1月, 2008 1 次提交
    • L
      Make on-disk index representation separate from in-core one · 7a51ed66
      Linus Torvalds 提交于
      This converts the index explicitly on read and write to its on-disk
      format, allowing the in-core format to contain more flags, and be
      simpler.
      
      In particular, the in-core format is now host-endian (as opposed to the
      on-disk one that is network endian in order to be able to be shared
      across machines) and as a result we can dispense with all the
      htonl/ntohl on accesses to the cache_entry fields.
      
      This will make it easier to make use of various temporary flags that do
      not exist in the on-disk format.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7a51ed66
  11. 26 9月, 2007 1 次提交
  12. 17 9月, 2007 1 次提交
  13. 11 9月, 2007 1 次提交
    • P
      Strbuf API extensions and fixes. · f1696ee3
      Pierre Habouzit 提交于
        * Add strbuf_rtrim to remove trailing spaces.
        * Add strbuf_insert to insert data at a given position.
        * Off-by one fix in strbuf_addf: strbuf_avail() does not counts the final
          \0 so the overflow test for snprintf is the strict comparison. This is
          not critical as the growth mechanism chosen will always allocate _more_
          memory than asked, so the second test will not fail. It's some kind of
          miracle though.
        * Add size extension hints for strbuf_init and strbuf_read. If 0, default
          applies, else:
            + initial buffer has the given size for strbuf_init.
            + first growth checks it has at least this size rather than the
              default 8192.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f1696ee3
  14. 07 9月, 2007 1 次提交
  15. 23 6月, 2007 1 次提交
  16. 22 5月, 2007 1 次提交
  17. 11 4月, 2007 1 次提交
  18. 14 11月, 2006 1 次提交
  19. 31 10月, 2006 1 次提交
  20. 15 10月, 2006 1 次提交
  21. 24 8月, 2006 1 次提交
    • S
      Convert memcpy(a,b,20) to hashcpy(a,b). · e702496e
      Shawn Pearce 提交于
      This abstracts away the size of the hash values when copying them
      from memory location to memory location, much as the introduction
      of hashcmp abstracted away hash value comparsion.
      
      A few call sites were using char* rather than unsigned char* so
      I added the cast rather than open hashcpy to be void*.  This is a
      reasonable tradeoff as most call sites already use unsigned char*
      and the existing hashcmp is also declared to be unsigned char*.
      
      [jc: Splitted the patch to "master" part, to be followed by a
       patch for merge-recursive.c which is not in "master" yet.
      
       Fixed the cast in the latter hunk to combine-diff.c which was
       wrong in the original.
      
       Also converted ones left-over in combine-diff.c, diff-lib.c and
       upload-pack.c ]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e702496e
  22. 04 5月, 2006 1 次提交
  23. 02 5月, 2006 2 次提交
    • J
      write-tree: --prefix=<path> · 6bd20358
      Junio C Hamano 提交于
      The "bind" commit can express an aggregation of multiple
      projects into a single commit.
      
      In such an organization, there would be one project, root of
      whose tree object is at the same level of the root of the
      aggregated projects, and other projects have their toplevel in
      separate subdirectories.  Let's call that root level project the
      "primary project", and call other ones just "subprojects".
      
      You would first read-tree the primary project, and then graft
      the subprojects under their appropriate location using read-tree
      --prefix=<subdir>/ repeatedly.
      
      To write out a tree object from such an index for a subproject,
      write-tree --prefix=<subdir>/ is used.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      6bd20358
    • J
      cache-tree: replace a sscanf() by two strtol() calls · 0111ea38
      Johannes Schindelin 提交于
      On one of my systems, sscanf() first calls strlen() on the buffer. But
      this buffer is not terminated by NUL. So git crashed.
      
      strtol() does not share that problem, as it stops reading after the
      first non-digit.
      
      [jc: original patch was wrong and did not read the cache-tree
       structure correctly; this has been fixed up and tested minimally
       with fsck-objects. ]
      Signed-off-by: NJohannes Schindelin <Johannes.Schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      0111ea38
  24. 28 4月, 2006 2 次提交
  25. 27 4月, 2006 1 次提交
    • J
      read-tree: teach 1-way merege and plain read to prime cache-tree. · 7927a55d
      Junio C Hamano 提交于
      This teaches read-tree to fully populate valid cache-tree when
      reading a tree from scratch, or reading a single tree into an
      existing index, reusing only the cached stat information (i.e.
      one-way merge).  We have already taught update-index about cache-tree,
      so "git checkout" followed by updates to a few path followed by
      a "git commit" would become very efficient.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      7927a55d
  26. 26 4月, 2006 1 次提交
    • J
      cache-tree: sort the subtree entries. · 61fa3097
      Junio C Hamano 提交于
      Not that this makes practical performance difference; the kernel tree
      for example has 200 or so directories that have subdirectory, and the
      largest ones have 57 of them (fs and drivers).  With a test to apply
      600 patches with git-apply and git-write-tree, this did not make more
      than one per-cent of a difference, but it is a good cleanup.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      61fa3097
  27. 25 4月, 2006 2 次提交
  28. 24 4月, 2006 1 次提交
    • J
      Add cache-tree. · 74986462
      Junio C Hamano 提交于
      The cache_tree data structure is to cache tree object names that
      would result from the current index file.
      
      The idea is to have an optional file to record each tree object
      name that corresponds to a directory path in the cache when we
      run write_cache(), and read it back when we run read_cache().
      During various index manupulations, we selectively invalidate
      the parts so that the next write-tree can bypass regenerating
      tree objects for unchanged parts of the directory hierarchy.
      
      We could perhaps make the cache-tree data an optional part of
      the index file, but that would involve the index format updates,
      so unless we need it for performance reasons, the current plan
      is to use a separate file, $GIT_DIR/index.aux to store this
      information and link it with the index file with the checksum
      that is already used for index file integrity check.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      74986462