Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on May 27, 2010
  1. @dotdash

    diff: Support visibility modifiers in the PHP hunk header regexp

    dotdash committed with
    Starting with PHP5, class methods can have a visibility modifier, which
    caused the methods not to be matched by the existing regexp, so extend
    the regexp to match those modifiers. And while we're at it, allow the
    "static" modifier as well.
    Since the "static" modifier can appear either before or after the
    visibility modifier, let's just allow any number of modifiers to appear
    in any order, as that simplifies the regexp and shouldn't cause any
    false positives.
    Signed-off-by: Björn Steinbrink <>
    Signed-off-by: Junio C Hamano <>
Commits on Jan 17, 2010
  1. git_attr(): fix function signature

    The function took (name, namelen) as its arguments, but all the public
    callers wanted to pass a full string.
    Demote the counted-string interface to an internal API status, and allow
    public callers to just pass the string to the function.
    Signed-off-by: Junio C Hamano <>
Commits on Jun 18, 2009
  1. @bonzini

    avoid exponential regex match for java and objc function names

    bonzini committed with
    In the old regex
    ^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\([^;]*)$
    you can backtrack arbitrarily from [A-Za-z_0-9]* into [A-Za-z_], thus
    causing an exponential number of backtracks.  Ironically it also causes
    the regex not to work as intended; for example "catch" can match the
    underlined part of the regex, the first repetition matching "c" and
    the second matching "atch".
    The replacement regex avoids this problem, because it makes sure that
    at least a space/tab is eaten on each repetition.  In other words,
    a suffix of a repetition can never be a prefix of the next repetition.
    Signed-off-by: Paolo Bonzini <>
    Signed-off-by: Junio C Hamano <>
Commits on Jan 22, 2009
  1. @stephen-smith

    Change the spelling of "wordregex".

    stephen-smith committed with
    Use "wordRegex" for configuration variable names.  Use "word_regex" for C
    language tokens.
    Signed-off-by: Boyd Stephen Smith Jr. <>
    Signed-off-by: Junio C Hamano <>
Commits on Jan 17, 2009
  1. @trast

    color-words: make regex configurable via attributes

    trast committed with
    Make the --color-words splitting regular expression configurable via
    the diff driver's 'wordregex' attribute.  The user can then set the
    driver on a file in .gitattributes.  If a regex is given on the
    command line, it overrides the driver's setting.
    We also provide built-in regexes for the languages that already had
    funcname patterns, and add an appropriate diff driver entry for C/++.
    (The patterns are designed to run UTF-8 sequences into a single chunk
    to make sure they remain readable.)
    Signed-off-by: Thomas Rast <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 26, 2008
  1. @peff

    userdiff: require explicitly allowing textconv

    peff committed with
    Diffs that have been produced with textconv almost certainly
    cannot be applied, so we want to be careful not to generate
    them in things like format-patch.
    This introduces a new diff options, ALLOW_TEXTCONV, which
    controls this behavior. It is off by default, but is
    explicitly turned on for the "log" family of commands, as
    well as the "diff" porcelain (but not diff-* plumbing).
    Because both text conversion and external diffing are
    controlled by these diff options, we can get rid of the
    "plumbing versus porcelain" distinction when reading the
    config. This was an attempt to control the same thing, but
    suffered from being too coarse-grained.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 18, 2008
  1. @peff

    diff: add filter for converting binary to text

    peff committed with
    When diffing binary files, it is sometimes nice to see the
    differences of a canonical text form rather than either a
    binary patch or simply "binary files differ."
    Until now, the only option for doing this was to define an
    external diff command to perform the diff. This was a lot of
    work, since the external command needed to take care of
    doing the diff itself (including mode changes), and lost the
    benefit of git's colorization and other options.
    This patch adds a text conversion option, which converts a
    file to its canonical format before performing the diff.
    This is less flexible than an arbitrary external diff, but
    is much less work to set up. For example:
      $ echo '*.jpg diff=exif' >>.gitattributes
      $ git config diff.exif.textconv exiftool
      $ git config diff.exif.binary false
    allows one to see jpg diffs represented by the text output
    of exiftool.
    Signed-off-by: Jeff King <>
    Signed-off-by: Shawn O. Pearce <>
  2. @peff

    diff: introduce diff.<driver>.binary

    peff committed with
    The "diff" gitattribute is somewhat overloaded right now. It
    can say one of three things:
      1. this file is definitely binary, or definitely not
         (i.e., diff or !diff)
      2. this file should use an external diff engine (i.e.,
         diff=foo, = custom-script)
      3. this file should use particular funcname patterns
         (i.e., diff=foo, = some-regex)
    Most of the time, there is no conflict between these uses,
    since using one implies that the other is irrelevant (e.g.,
    an external diff engine will decide for itself whether the
    file is binary).
    However, there is at least one conflicting situation: there
    is no way to say "use the regular rules to determine whether
    this file is binary, but if we do diff it textually, use
    this funcname pattern." That is, currently setting diff=foo
    indicates that the file is definitely text.
    This patch introduces a "binary" config option for a diff
    driver, so that one can explicitly set We
    default this value to "don't know". That is, setting a diff
    attribute to "foo" and using "" will have
    no effect on the binaryness of a file. To get the current
    behavior, one can set to true.
    This patch also has one additional advantage: it cleans up
    the interface to the userdiff code a bit. Before, calling
    code had to know more about whether attributes were false,
    true, or unset to determine binaryness. Now that binaryness
    is a property of a driver, we can represent these situations
    just by passing back a driver struct.
    Signed-off-by: Jeff King <>
    Signed-off-by: Shawn O. Pearce <>
  3. @peff

    diff: unify external diff and funcname parsing code

    peff committed with
    Both sets of code assume that one specifies a diff profile
    as a gitattribute via the "diff=foo" attribute. They then
    pull information about that profile from the config as*.
    The code for each is currently completely separate from the
    other, which has several disadvantages:
      - there is duplication as we maintain code to create and
        search the separate lists of external drivers and
        funcname patterns
      - it is difficult to add new profile options, since it is
        unclear where they should go
      - the code is difficult to follow, as we rely on the
        "check if this file is binary" code to find the funcname
        pattern as a side effect. This is the first step in
        refactoring the binary-checking code.
    This patch factors out these diff profiles into "userdiff"
    drivers. A file with "diff=foo" uses the "foo" driver, which
    is specified by a single struct.
    Note that one major difference between the two pieces of
    code is that the funcname patterns are always loaded,
    whereas external drivers are loaded only for the "git diff"
    porcelain; the new code takes care to retain that situation.
    Signed-off-by: Jeff King <>
    Signed-off-by: Shawn O. Pearce <>
Something went wrong with that request. Please try again.