summaryrefslogtreecommitdiff
path: root/tests/network/refspecs.c
Commit message (Collapse)AuthorAgeFilesLines
* refspec: return GIT_EINVALIDSPEC for invalid specsEdward Thomson2020-10-251-1/+1
| | | | | | | Disambiguate invalid specifications in `git_refspec__parse` so that callers can determine the difference between invalid specifications and actual errors. No call sites wil propagagte this new error message to an end-user, so there is no user-facing API change.
* tests: add missing error checksPatrick Steinhardt2020-02-071-1/+1
| | | | | | We should always verify error codes returned by function calls in our test suite to not accidentally miss any weird results. Coverity reported missing checks in several locations, which this commit fixes.
* refspec: fix transforming nested starsPatrick Steinhardt2019-04-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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".
* refs: loosen restriction on wildcard "*" refspecsPatrick Steinhardt2019-04-261-4/+13
| | | | | | | | | | | | In commit cd377f45c9 (refs: loosen restriction on wildcard "*" refspecs, 2015-07-22) in git.git, the restrictions on wildcard "*" refspecs has been loosened. While wildcards were previously only allowed if the component is a single "*", this was changed to also accept other patterns as part of the component. We never adapted to that change and still reject any wildcard patterns that aren't a single "*" only. Update our tests to reflect the upstream change and adjust our own code accordingly.
* tests: network::refspecs: add missing assert when parsing refspecPatrick Steinhardt2019-04-261-1/+1
|
* treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-131-3/+3
| | | | | | | | | C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
* Merge pull request #4699 from nelhage/fetch-null-dstPatrick Steinhardt2018-07-061-0/+5
|\ | | | | git_refspec_transform: Handle NULL dst
| * formatting fixNelson Elhage2018-06-291-1/+2
| |
| * Add a test.Nelson Elhage2018-06-251-0/+4
| | | | | | | | Verified that this breaks before the fix and passes afterwards.
* | refspec: rename `git_refspec__free` to `git_refspec__dispose`Patrick Steinhardt2018-06-291-5/+5
| | | | | | | | | | | | | | | | | | Since commit 630a67366 (refspec: add public parsing api, 2018-02-07), we now have two functions `git_refspec_free` and `git_refspec__free`. The difference is that the first one will free the structure itself, while the second one will only free the structure's contents. Use our new `dispose` naming pattern for the latter function to help avoid confusion.
* | refspec: add public parsing apicynecx2018-06-221-0/+12
|/ | | | | | | | | | | | | | | | | | | | Fix typo Fix some type issues More fixes Address requested changes Add test Fix naming Fix condition and tests Address requested changes Fix typo
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-3/+3
|
* Fix memory leak in tests/network/refspecs.cJeff Hostetler2015-06-171-0/+2
|
* refspec: make sure matching refspecs have src, dst and input stringsCarlos Martín Nieto2015-05-221-0/+10
| | | | | | | | When we find out that we're dealing with a matching refspec, we set the flag and return immediately. This leaves the strings as NULL, which breaks the contract. Assign these pointers to a string with the correct values.
* Check if the refspec matches before transformingJacques Germishuys2014-08-171-5/+43
|
* refspec: support asterisks in the middle of a patternCarlos Martín Nieto2014-07-041-0/+23
| | | | | | | | | | We used to assume a refspec would only have an asterisk in the middle of their respective pattern. This has not been a valid assumption for some time now with git. Instead of assuming where the asterisk is going to be, change the logic to treat each pattern as having two halves with a replacement bit in the middle, where the asterisk is.
* Rename tests-clar to testsBen Straub2013-11-141-0/+87