1. 03 10月, 2008 1 次提交
    • N
      fix openssl headers conflicting with custom SHA1 implementations · 9126f009
      Nicolas Pitre 提交于
      On ARM I have the following compilation errors:
      
          CC fast-import.o
      In file included from cache.h:8,
                       from builtin.h:6,
                       from fast-import.c:142:
      arm/sha1.h:14: error: conflicting types for 'SHA_CTX'
      /usr/include/openssl/sha.h:105: error: previous declaration of 'SHA_CTX' was here
      arm/sha1.h:16: error: conflicting types for 'SHA1_Init'
      /usr/include/openssl/sha.h:115: error: previous declaration of 'SHA1_Init' was here
      arm/sha1.h:17: error: conflicting types for 'SHA1_Update'
      /usr/include/openssl/sha.h:116: error: previous declaration of 'SHA1_Update' was here
      arm/sha1.h:18: error: conflicting types for 'SHA1_Final'
      /usr/include/openssl/sha.h:117: error: previous declaration of 'SHA1_Final' was here
      make: *** [fast-import.o] Error 1
      
      This is because openssl header files are always included in
      git-compat-util.h since commit 684ec6c6 whenever NO_OPENSSL is not
      set, which somehow brings in <openssl/sha1.h> clashing with the custom
      ARM version.  Compilation of git is probably broken on PPC too for the
      same reason.
      
      Turns out that the only file requiring openssl/ssl.h and openssl/err.h
      is imap-send.c.  But only moving those problematic includes there
      doesn't solve the issue as it also includes cache.h which brings in the
      conflicting local SHA1 header file.
      
      As suggested by Jeff King, the best solution is to rename our references
      to SHA1 functions and structure to something git specific, and define those
      according to the implementation used.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      9126f009
  2. 23 9月, 2008 1 次提交
  3. 01 9月, 2008 1 次提交
  4. 30 8月, 2008 1 次提交
  5. 20 7月, 2008 1 次提交
    • A
      Support gitlinks in fast-import. · 03db4525
      Alexander Gavrilov 提交于
      Currently fast-import/export cannot be used for
      repositories with submodules. This patch extends
      the relevant programs to make them correctly
      process gitlinks.
      
      Links can be represented by two forms of the
      Modify command:
      
      M 160000 SHA1 some/path
      
      which sets the link target explicitly, or
      
      M 160000 :mark some/path
      
      where the mark refers to a commit. The latter
      form can be used by importing tools to build
      all submodules simultaneously in one physical
      repository, and then simply fetch them apart.
      Signed-off-by: NAlexander Gavrilov <angavrilov@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      03db4525
  6. 14 7月, 2008 1 次提交
    • S
      Make usage strings dash-less · 1b1dd23f
      Stephan Beyer 提交于
      When you misuse a git command, you are shown the usage string.
      But this is currently shown in the dashed form.  So if you just
      copy what you see, it will not work, when the dashed form
      is no longer supported.
      
      This patch makes git commands show the dash-less version.
      
      For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
      generates a dash-less usage string now.
      Signed-off-by: NStephan Beyer <s-beyer@gmx.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b1dd23f
  7. 01 6月, 2008 1 次提交
  8. 17 5月, 2008 1 次提交
  9. 15 5月, 2008 1 次提交
  10. 17 3月, 2008 1 次提交
  11. 09 3月, 2008 1 次提交
  12. 03 3月, 2008 1 次提交
  13. 16 2月, 2008 4 次提交
  14. 21 1月, 2008 2 次提交
  15. 19 1月, 2008 1 次提交
  16. 18 1月, 2008 2 次提交
    • S
      Fix random fast-import errors when compiled with NO_MMAP · c9ced051
      Shawn O. Pearce 提交于
      fast-import was relying on the fact that on most systems mmap() and
      write() are synchronized by the filesystem's buffer cache.  We were
      relying on the ability to mmap() 20 bytes beyond the current end
      of the file, then later fill in those bytes with a future write()
      call, then read them through the previously obtained mmap() address.
      
      This isn't always true with some implementations of NFS, but it is
      especially not true with our NO_MMAP=YesPlease build time option used
      on some platforms.  If fast-import was built with NO_MMAP=YesPlease
      we used the malloc()+pread() emulation and the subsequent write()
      call does not update the trailing 20 bytes of a previously obtained
      "mmap()" (aka malloc'd) address.
      
      Under NO_MMAP that behavior causes unpack_entry() in sha1_file.c to
      be unable to read an object header (or data) that has been unlucky
      enough to be written to the packfile at a location such that it
      is in the trailing 20 bytes of a window previously opened on that
      same packfile.
      
      This bug has gone unnoticed for a very long time as it is highly data
      dependent.  Not only does the object have to be placed at the right
      position, but it also needs to be positioned behind some other object
      that has been accessed due to a branch cache invalidation.  In other
      words the stars had to align just right, and if you did run into
      this bug you probably should also have purchased a lottery ticket.
      
      Fortunately the workaround is a lot easier than the bug explanation.
      
      Before we allow unpack_entry() to read data from a pack window
      that has also (possibly) been modified through write() we force
      all existing windows on that packfile to be closed.  By closing
      the windows we ensure that any new access via the emulated mmap()
      will reread the packfile, updating to the current file content.
      
      This comes at a slight performance degredation as we cannot reuse
      previously cached windows when we update the packfile.  But it
      is a fairly minor difference as the window closes happen at only
      two points:
      
       - When the packfile is finalized and its .idx is generated:
      
         At this stage we are getting ready to update the refs and any
         data access into the packfile is going to be random, and is
         going after only the branch tips (to ensure they are valid).
         Our existing windows (if any) are not likely to be positioned
         at useful locations to access those final tip commits so we
         probably were closing them before anyway.
      
       - When the branch cache missed and we need to reload:
      
         At this point fast-import is getting change commands for the next
         commit and it needs to go re-read a tree object it previously
         had written out to the packfile.  What windows we had (if any)
         are not likely to cover the tree in question so we probably were
         closing them before anyway.
      
      We do try to avoid unnecessarily closing windows in the second case
      by checking to see if the packfile size has increased since the
      last time we called unpack_entry() on that packfile.  If the size
      has not changed then we have not written additional data, and any
      existing window is still vaild.  This nicely handles the cases where
      fast-import is going through a branch cache reload and needs to read
      many trees at once.  During such an event we are not likely to be
      updating the packfile so we do not cycle the windows between reads.
      
      With this change in place t9301-fast-export.sh (which was broken
      by c3b0dec5) finally works again.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c9ced051
    • B
      fast-import.c: don't try to commit marks file if write failed · fb54abd6
      Brandon Casey 提交于
      We also move the assignment of -1 to the lock file descriptor
      up, so that rollback_lock_file() can be called safely after a
      possible attempt to fclose(). This matches the contents of
      the 'if' statement just above testing success of fdopen().
      Signed-off-by: NBrandon Casey <casey@nrlssc.navy.mil>
      Acked-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fb54abd6
  17. 17 1月, 2008 1 次提交
  18. 10 1月, 2008 1 次提交
  19. 03 1月, 2008 1 次提交
    • J
      Update callers of check_ref_format() · 257f3020
      Junio C Hamano 提交于
      This updates send-pack and fast-import to use symbolic constants
      for checking the return values from check_ref_format(), and also
      futureproof the logic in lock_any_ref_for_update() to explicitly
      name the case that is usually considered an error but is Ok for
      this particular use.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      257f3020
  20. 15 12月, 2007 1 次提交
  21. 14 11月, 2007 1 次提交
    • S
      Don't allow fast-import tree delta chains to exceed maximum depth · 436e7a74
      Shawn O. Pearce 提交于
      Brian Downing noticed fast-import can produce tree depths of up
      to 6,035 objects and even deeper.  Long delta chains can create
      very small packfiles but cause problems during repacking as git
      needs to unpack each tree to count the reachable blobs.
      
      What's happening here is the active branch cache isn't big enough.
      We're swapping out the branch and thus recycling the tree information
      (struct tree_content) back into the free pool.  When we later reload
      the tree we set the delta_depth to 0 but we kept the tree we just
      reloaded as a delta base.
      
      So if the tree we reloaded was already at the maximum depth we
      wouldn't know it and make the new tree a delta.  Multiply the
      number of times the branch cache has to swap out the tree times
      max_depth (10) and you get the maximum delta depth of a tree created
      by fast-import.  In Brian's case above the active branch cache had
      to swap the branch out 603/604 times during this import to produce
      a tree with a delta depth of 6035.
      Acked-by: NBrian Downing <bdowning@lavos.net>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      436e7a74
  22. 27 10月, 2007 1 次提交
  23. 21 10月, 2007 1 次提交
  24. 29 9月, 2007 1 次提交
    • P
      strbuf change: be sure ->buf is never ever NULL. · b315c5c0
      Pierre Habouzit 提交于
      For that purpose, the ->buf is always initialized with a char * buf living
      in the strbuf module. It is made a char * so that we can sloppily accept
      things that perform: sb->buf[0] = '\0', and because you can't pass "" as an
      initializer for ->buf without making gcc unhappy for very good reasons.
      
      strbuf_init/_detach/_grow have been fixed to trust ->alloc and not ->buf
      anymore.
      
      as a consequence strbuf_detach is _mandatory_ to detach a buffer, copying
      ->buf isn't an option anymore, if ->buf is going to escape from the scope,
      and eventually be free'd.
      
      API changes:
        * strbuf_setlen now always works, so just make strbuf_reset a convenience
          macro.
        * strbuf_detatch takes a size_t* optional argument (meaning it can be
          NULL) to copy the buffer's len, as it was needed for this refactor to
          make the code more readable, and working like the callers.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b315c5c0
  25. 21 9月, 2007 2 次提交
    • P
      Rework unquote_c_style to work on a strbuf. · 7fb1011e
      Pierre Habouzit 提交于
      If the gain is not obvious in the diffstat, the resulting code is more
      readable, _and_ in checkout-index/update-index we now reuse the same buffer
      to unquote strings instead of always freeing/mallocing.
      
      This also is more coherent with the next patch that reworks quoting
      functions.
      
      The quoting function is also made more efficient scanning for backslashes
      and treating portions of strings without a backslash at once.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      7fb1011e
    • P
      strbuf API additions and enhancements. · c76689df
      Pierre Habouzit 提交于
      Add strbuf_remove, change strbuf_insert:
        As both are special cases of strbuf_splice, implement them as such.
        gcc is able to do the math and generate almost optimal code this way.
      
      Add strbuf_swap:
        Exchange the values of its arguments.
        Use it in fast-import.c
      
      Also fix spacing issues in strbuf.h
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      c76689df
  26. 19 9月, 2007 1 次提交
  27. 18 9月, 2007 3 次提交
  28. 17 9月, 2007 1 次提交
  29. 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
  30. 07 9月, 2007 2 次提交
    • P
      fast-import: Use strbuf API, and simplify cmd_data() · 4a241d79
      Pierre Habouzit 提交于
        This patch features the use of strbuf_detach, and prevent the programmer
      to mess with allocation directly. The code is as efficent as before, just
      more concise and more straightforward.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4a241d79
    • P
      Rework strbuf API and semantics. · b449f4cf
      Pierre Habouzit 提交于
        The gory details are explained in strbuf.h. The change of semantics this
      patch enforces is that the embeded buffer has always a '\0' character after
      its last byte, to always make it a C-string. The offs-by-one changes are all
      related to that very change.
      
        A strbuf can be used to store byte arrays, or as an extended string
      library. The `buf' member can be passed to any C legacy string function,
      because strbuf operations always ensure there is a terminating \0 at the end
      of the buffer, not accounted in the `len' field of the structure.
      
        A strbuf can be used to generate a string/buffer whose final size is not
      really known, and then "strbuf_detach" can be used to get the built buffer,
      and keep the wrapping "strbuf" structure usable for further work again.
      
        Other interesting feature: strbuf_grow(sb, size) ensure that there is
      enough allocated space in `sb' to put `size' new octets of data in the
      buffer. It helps avoiding reallocating data for nothing when the problem the
      strbuf helps to solve has a known typical size.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b449f4cf
  31. 21 8月, 2007 1 次提交