1. 21 3月, 2007 6 次提交
    • N
      improve checkout message when asking for same branch · 57216856
      Nicolas Pitre 提交于
      Change the feedback message if doing 'git checkout foo' when already on
      branch "foo".
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      57216856
    • L
      Be more careful about zlib return values · ac54c277
      Linus Torvalds 提交于
      When creating a new object, we use "deflate(stream, Z_FINISH)" in a loop
      until it no longer returns Z_OK, and then we do "deflateEnd()" to finish
      up business.
      
      That should all work, but the fact is, it's not how you're _supposed_ to
      use the zlib return values properly:
      
       - deflate() should never return Z_OK in the first place, except if we
         need to increase the output buffer size (which we're not doing, and
         should never need to do, since we pre-allocated a buffer that is
         supposed to be able to hold the output in full). So the "while()" loop
         was incorrect: Z_OK doesn't actually mean "ok, continue", it means "ok,
         allocate more memory for me and continue"!
      
       - if we got an error return, we would consider it to be end-of-stream,
         but it could be some internal zlib error.  In short, we should check
         for Z_STREAM_END explicitly, since that's the only valid return value
         anyway for the Z_FINISH case.
      
       - we never checked deflateEnd() return codes at all.
      
      Now, admittedly, none of these issues should ever happen, unless there is
      some internal bug in zlib. So this patch should make zero difference, but
      it seems to be the right thing to do.
      
      We should probablybe anal and check the return value of "deflateInit()"
      too!
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ac54c277
    • L
      Don't ever return corrupt objects from "parse_object()" · acdeec62
      Linus Torvalds 提交于
      Looking at the SHA1 validation code due to the corruption that Alexander
      Litvinov is seeing under Cygwin, I notice that one of the most central
      places where we read objects, we actually do end up verifying the SHA1 of
      the result, but then we happily parse it anyway.
      
      And using "printf" to write the error message means that it not only can
      get lost, but will actually mess up stdout, and cause other strange and
      hard-to-debug failures downstream.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      acdeec62
    • N
      index-pack: more validation checks and cleanups · 9096c660
      Nicolas Pitre 提交于
      When appending objects to a pack, make sure the appended data is really
      what we expect instead of simply loading potentially corrupted objects
      and legitimating them by computing a SHA1 of that corrupt data.
      
      With this the sha1_object() can lose its test_for_collision parameter
      which is now redundent.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9096c660
    • N
      index-pack: use hash_sha1_file() · ce9fbf16
      Nicolas Pitre 提交于
      Use hash_sha1_file() instead of duplicating code to compute object SHA1.
      While at it make it accept a const pointer.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ce9fbf16
    • N
      don't ever allow SHA1 collisions to exist by fetching a pack · 8685da42
      Nicolas Pitre 提交于
      Waaaaaaay back Git was considered to be secure as it never overwrote
      an object it already had.  This was ensured by always unpacking the
      packfile received over the network (both in fetch and receive-pack)
      and our already existing logic to not create a loose object for an
      object we already have.
      
      Lately however we keep "large-ish" packfiles on both fetch and push
      by running them through index-pack instead of unpack-objects.  This
      would let an attacker perform a birthday attack.
      
      How?  Assume the attacker knows a SHA-1 that has two different
      data streams.  He knows the client is likely to have the "good"
      one.  So he sends the "evil" variant to the other end as part of
      a "large-ish" packfile.  The recipient keeps that packfile, and
      indexes it.  Now since this is a birthday attack there is a SHA-1
      collision; two objects exist in the repository with the same SHA-1.
      They have *very* different data streams.  One of them is "evil".
      
      Currently the poor recipient cannot tell the two objects apart,
      short of by examining the timestamp of the packfiles.  But lets
      say the recipient repacks before he realizes he's been attacked.
      We may wind up packing the "evil" version of the object, and deleting
      the "good" one.  This is made *even more likely* by Junio's recent
      rearrange_packed_git patch (b867092f).
      
      It is extremely unlikely for a SHA1 collisions to occur, but if it
      ever happens with a remote (hence untrusted) object we simply must
      not let the fetch succeed.
      
      Normally received packs should not contain objects we already have.
      But when they do we must ensure duplicated objects with the same SHA1
      actually contain the same data.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8685da42
  2. 20 3月, 2007 12 次提交
  3. 19 3月, 2007 20 次提交
    • J
      GIT 1.5.1-rc1 · ceb8442a
      Junio C Hamano 提交于
      I think we can start to slow down, as we now have covered
      everything I listed earlier in the short-term release plan.
      
      The last release 1.5.0 took painfully too long.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ceb8442a
    • J
      Fix merge-index · 843d49a4
      Junio C Hamano 提交于
      An earlier conversion to run_command() from execlp() forgot that
      run_command() takes an array that is terminated with NULL.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      843d49a4
    • L
      Set up for better tree diff optimizations · 5d865017
      Linus Torvalds 提交于
      This is mainly just a cleanup patch, and sets up for later changes where
      the tree-diff.c "interesting()" function can return more than just a
      yes/no value.
      
      In particular, it should be quite possible to say "no subsequent entries
      in this tree can possibly be interesting any more", and thus allow the
      callers to short-circuit the tree entirely.
      
      In fact, changing the callers to do so is trivial, and is really all this
      patch really does, because changing "interesting()" itself to say that
      nothing further is going to be interesting is definitely more complicated,
      considering that we may have arbitrary pathspecs.
      
      But in cleaning up the callers, this actually fixes a potential small
      performance issue in diff_tree(): if the second tree has a lot of
      uninterestign crud in it, we would keep on doing the "is it interesting?"
      check on the first tree for each uninteresting entry in the second one.
      
      The answer is obviously not going to change, so that was just not helping.
      The new code is clearer and simpler and avoids this issue entirely.
      
      I also renamed "interesting()" to "tree_entry_interesting()", because I
      got frustrated by the fact that
      
       - we actually had *another* function called "interesting()" in another
         file, and I couldn't tell from the profiles which one was the one that
         mattered more.
      
       - when rewriting it to return a ternary value, you can't just do
      
      	if (interesting(...))
      		...
      
         any more, but want to assign the return value to a local variable. The
         name of choice for that variable would normally be "interesting", so
         I just wanted to make the function name be more specific, and avoid
         that whole issue (even though I then didn't choose that name for either
         of the users, just to avoid confusion in the patch itself ;)
      
      In other words, this doesn't really change anything, but I think it's a
      good thing to do, and if somebody comes along and writes the logic for
      "yeah, none of the pathspecs you have are interesting", we now support
      that trivially.
      
      It could easily be a meaningful optimization for things like "blame",
      where there's just one pathspec, and stopping when you've seen it would
      allow you to avoid about 50% of the tree traversals on average.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5d865017
    • L
      Trivial cleanup of track_tree_refs() · c711a214
      Linus Torvalds 提交于
      This makes "track_tree_refs()" use the same "tree_entry()" function for
      counting the entries as it does for actually traversing them a few lines
      later.
      
      Not a biggie, but the reason I care was that this was the only user of
      "update_tree_entry()" that didn't actually *extract* the tree entry first.
      It doesn't matter as things stand now, but it meant that a separate
      test-patch I had that avoided a few more "strlen()" calls by just saving
      the entry length in the entry descriptor and using it directly when
      updating wouldn't work without this patch.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      c711a214
    • A
      git.el: Add support for commit hooks. · d55552f6
      Alexandre Julliard 提交于
      Run the pre-commit and post-commit hooks at appropriate places, and
      display their output if any.
      Signed-off-by: NAlexandre Julliard <julliard@winehq.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      d55552f6
    • J
      Merge branch 'jb/gc' · 94b9816c
      Junio C Hamano 提交于
      * jb/gc:
        Make gc a builtin.
      94b9816c
    • J
      Merge branch 'fl/cvsserver' · de5e61eb
      Junio C Hamano 提交于
      * fl/cvsserver:
        cvsserver: further improve messages on commit and status
        cvsserver: Be more chatty
      de5e61eb
    • S
      Limit the size of the new delta_base_cache · 18bdec11
      Shawn O. Pearce 提交于
      The new configuration variable core.deltaBaseCacheLimit allows the
      user to control how much memory they are willing to give to Git for
      caching base objects of deltas.  This is not normally meant to be
      a user tweakable knob; the "out of the box" settings are meant to
      be suitable for almost all workloads.
      
      We default to 16 MiB under the assumption that the cache is not
      meant to consume all of the user's available memory, and that the
      cache's main purpose was to cache trees, for faster path limiters
      during revision traversal.  Since trees tend to be relatively small
      objects, this relatively small limit should still allow a large
      number of objects.
      
      On the other hand we don't want the cache to start storing 200
      different versions of a 200 MiB blob, as this could easily blow
      the entire address space of a 32 bit process.
      
      We evict OBJ_BLOB from the cache first (credit goes to Junio) as
      we want to favor OBJ_TREE within the cache.  These are the objects
      that have the highest inflate() startup penalty, as they tend to
      be small and thus don't have that much of a chance to ammortize
      that penalty over the entire data.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      18bdec11
    • J
      Merge branch 'sp/run-command' · 3635a187
      Junio C Hamano 提交于
      * sp/run-command:
        Use run_command within send-pack
        Use run_command within receive-pack to invoke index-pack
        Use run_command within merge-index
        Use run_command for proxy connections
        Use RUN_GIT_CMD to run push backends
        Correct new compiler warnings in builtin-revert
        Replace fork_with_pipe in bundle with run_command
        Teach run-command to redirect stdout to /dev/null
        Teach run-command about stdout redirection
      3635a187
    • J
      Make git-send-email aware of Cc: lines. · abec100c
      J. Bruce Fields 提交于
      In the Linux kernel, for example, it's common to include Cc: lines
      for cases when you want to remember to cc someone on a patch without
      necessarily claiming they signed off on it.  Make git-send-email
      aware of these.
      Signed-off-by: N"J. Bruce Fields" <bfields@citi.umich.edu>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      abec100c
    • T
      mergetool: print an appropriate warning if merge.tool is unknown · d6678c28
      Theodore Ts'o 提交于
      Also add support for vimdiff
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      d6678c28
    • J
      mergetool: Add support for vimdiff. · 9cec6539
      James Bowes 提交于
      Signed-off-by: NJames Bowes <jbowes@dangerouslyinc.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      9cec6539
    • J
      7976ce1b
    • J
      Merge branch 'ar/diff' · d54fe394
      Junio C Hamano 提交于
      * ar/diff:
        Add tests for --quiet option of diff programs
        try-to-simplify-commit: use diff-tree --quiet machinery.
        revision.c: explain what tree_difference does
        Teach --quiet to diff backends.
        diff --quiet
        Remove unused diffcore_std_no_resolve
        Allow git-diff exit with codes similar to diff(1)
      d54fe394
    • L
      Avoid unnecessary strlen() calls · 304de2d2
      Linus Torvalds 提交于
      This is a micro-optimization that grew out of the mailing list discussion
      about "strlen()" showing up in profiles.
      
      We used to pass regular C strings around to the low-level tree walking
      routines, and while this worked fine, it meant that we needed to call
      strlen() on strings that the caller always actually knew the size of
      anyway.
      
      So pass the length of the string down wih the string, and avoid
      unnecessary calls to strlen(). Also, when extracting a pathname from a
      tree entry, use "tree_entry_len()" instead of strlen(), since the length
      of the pathname is directly calculable from the decoded tree entry itself
      without having to actually do another strlen().
      
      This shaves off another ~5-10% from some loads that are very tree
      intensive (notably doing commit filtering by a pathspec).
      
      Signed-off-by: Linus Torvalds  <torvalds@linux-foundation.org>"
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      304de2d2
    • N
      Reuse cached data out of delta base cache. · a0cba108
      Nicolas Pitre 提交于
      A malloc() + memcpy() will always be faster than mmap() +
      malloc() + inflate().  If the data is already there it is
      certainly better to copy it straight away.
      
      With this patch below I can do 'git log drivers/scsi/ >
      /dev/null' about 7% faster.  I bet it might be even more on
      those platforms with bad mmap() support.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      a0cba108
    • L
      Implement a simple delta_base cache · e5e01619
      Linus Torvalds 提交于
      This trivial 256-entry delta_base cache improves performance for some
      loads by a factor of 2.5 or so.
      
      Instead of always re-generating the delta bases (possibly over and over
      and over again), just cache the last few ones. They often can get re-used.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e5e01619
    • L
      Make trivial wrapper functions around delta base generation and freeing · 62f255ad
      Linus Torvalds 提交于
      This doesn't change any code, it just creates a point for where we'd
      actually do the caching of delta bases that have been generated.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      62f255ad
    • J
      Merge 1.5.0.5 in from 'maint' · 5bb44a51
      Junio C Hamano 提交于
      5bb44a51
    • J
      GIT 1.5.0.5 · 6bf035f2
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      6bf035f2
  4. 17 3月, 2007 2 次提交