Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Dec 13, 2011
  1. @peff @gitster

    strbuf: add strbuf_add*_urlencode

    peff authored gitster committed
    This just follows the rfc3986 rules for percent-encoding
    url data into a strbuf.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 22, 2011
  1. @peff @gitster

    strbuf: allow strbuf_split to work on non-strbufs

    peff authored gitster committed
    The strbuf_split function takes a strbuf as input, and
    outputs a list of strbufs. However, there is no reason that
    the input has to be a strbuf, and not an arbitrary buffer.
    
    This patch adds strbuf_split_buf for a length-delimited
    buffer, and strbuf_split_str for NUL-terminated strings.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @peff @gitster

    strbuf_split: add a max parameter

    peff authored gitster committed
    Sometimes when splitting, you only want a limited number of
    fields, and for the final field to contain "everything
    else", even if it includes the delimiter.
    
    This patch introduces strbuf_split_max, which provides a
    "max number of fields" parameter; it behaves similarly to
    perl's "split" with a 3rd field.
    
    The existing 2-argument form of strbuf_split is retained for
    compatibility and ease-of-use.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 26, 2011
  1. @peff @gitster

    strbuf: add strbuf_vaddf

    peff authored gitster committed
    In a variable-args function, the code for writing into a strbuf is
    non-trivial. We ended up cutting and pasting it in several places
    because there was no vprintf-style function for strbufs (which in turn
    was held up by a lack of va_copy).
    
    Now that we have a fallback va_copy, we can add strbuf_vaddf, the
    strbuf equivalent of vsprintf. And we can clean up the cut and paste
    mess.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Improved-by: Christian Couder <christian.couder@gmail.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 14, 2010
  1. @peff @gitster

    strbuf: add strbuf_addbuf_percentquote

    peff authored gitster committed
    This is handy for creating strings which will be fed to printf() or
    strbuf_expand().
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @peff @gitster

    strbuf_expand: convert "%%" to "%"

    peff authored gitster committed
    The only way to safely quote arbitrary text in a pretty-print user
    format is to replace instances of "%" with "%x25". This is slightly
    unreadable, and many users would expect "%%" to produce a single
    "%", as that is what printf format specifiers do.
    
    This patch converts "%%" to "%" for all users of strbuf_expand():
    
     (1) git-daemon interpolated paths
    
     (2) pretty-print user formats
    
     (3) merge driver command lines
    
    Case (1) was already doing the conversion itself outside of
    strbuf_expand(). Case (2) is the intended beneficiary of this patch.
    Case (3) users probably won't notice, but as this is user-facing
    behavior, consistently providing the quoting mechanism makes sense.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.