• Show log

    Commit

  • Hash : 0c71e4cb
    Author : Patrick Steinhardt
    Date : 2019-04-26T10:38:02

    refspec: fix transforming nested stars
    
    When we transform a refspec with a component containing a glob, then
    we simply copy over the component until the next separator from
    the matching ref. E.g. if we have a ref "refs/heads/foo/bar" and
    a refspec "refs/heads/*/bar:refs/remotes/origin/*/bar", we:
    
    1. Copy over everything until hitting the glob from the <dst>
       part: "refs/remotes/origin/".
    2. Strip the common prefix of ref and <src> part until the glob,
       which is "refs/heads/". This leaves us with a ref of "foo/bar".
    3. Copy from the ref until the next "/" separator, resulting in
       "refs/remotes/origin/foo".
    4. Copy over the remaining part of the <dst> spec, which is
       "bar": "refs/remotes/origin/foo/bar".
    
    This worked just fine in a world where globs in refspecs were
    restricted such that a globbing component may only contain a
    single "*", only. But this restriction has been lifted, so that a
    glob component may be nested between other characters, causing
    the above algorithm to fail. Most notably the third step, where
    we copy until hitting the next "/" separator, might result in a
    wrong transformation. Given e.g. a ref "refs/gbranchg/head" and a
    refspec "refs/g*g/head:refs/remotes/origin/*", we'd also be
    copying the "g" between "branch" and "/" and end up with the
    wrong transformed ref "refs/remotes/origin/branchg".
    
    Instead of copying until the next component separator, we should
    copy until we hit the pattern after the "*". So in the above
    example, we'd copy until hitting the string "g/head".
    

  • README.md

  • Writing Clar tests for libgit2

    For information on the Clar testing framework and a detailed introduction please visit:

    https://github.com/vmg/clar

    • Write your modules and tests. Use good, meaningful names.

    • Make sure you actually build the tests by setting:

        cmake -DBUILD_CLAR=ON build/
    • Test:

        ./build/libgit2_clar
    • Make sure everything is fine.

    • Send your pull request. That’s it.