1. 17 9月, 2007 1 次提交
  2. 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
  3. 07 9月, 2007 1 次提交
    • 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
  4. 18 5月, 2005 1 次提交
  5. 26 4月, 2005 1 次提交
    • J
      [PATCH] Introduce diff-tree-helper. · d1df5743
      Junio C Hamano 提交于
      This patch introduces a new program, diff-tree-helper.  It reads
      output from diff-cache and diff-tree, and produces a patch file.
      The diff format customization can be done the same way the
      show-diff uses; the same external diff interface introduced by
      the previous patch to drive diff from show-diff is used so this
      is not surprising.
      
      It is used like the following examples:
      
         $ diff-cache --cached -z <tree> | diff-tree-helper -z -R paths...
         $ diff-tree -r -z <tree1> <tree2> | diff-tree-helper -z paths...
      
       - As usual, the use of the -z flag is recommended in the script
         to pass NUL-terminated filenames through the pipe between
         commands.
      
       - The -R flag is used to generate reverse diff.  It does not
         matter for diff-tree case, but it is sometimes useful to get
         a patch in the desired direction out of diff-cache.
      
       - The paths parameters are used to restrict the paths that
         appears in the output.  Again this is useful to use with
         diff-cache, which, unlike diff-tree, does not take such paths
         restriction parameters.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d1df5743