summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* online tests: use gitlab for auth failuresethomson/auth_failureEdward Thomson2019-06-051-1/+1
| | | | | | | | GitHub recently changed their behavior from returning 401s for private or nonexistent repositories on a clone to returning 404s. For our tests that require an auth failure (and 401), move to GitLab to request a missing repository. This lets us continue to test our auth failure case, at least until they decide to mimic that decision.
* Merge pull request #5076 from libgit2/ethomson/ignore_spacesEdward Thomson2019-06-056-11/+1342
|\ | | | | Ignore files: don't ignore whitespace
| * attr: ensure regular attr files can have whitespaceethomson/ignore_spacesEdward Thomson2019-05-243-7/+33
| | | | | | | | | | | | Unlike ignore files, gitattribute files can have flexible whitespace at the beginning of the line. Ensure that by adding new ignore rules that we have not impeded correct parsing of attribute files.
| * attr: optionally treat leading whitespace as significantEdward Thomson2019-05-241-4/+11
| | | | | | | | | | When `allow_space` is unset, ensure that leading whitespace is not skipped.
| * ignore: test that comments begin at position 0Edward Thomson2019-05-241-0/+4
| | | | | | | | | | | | Comments must have a '#' at the beginning of the line. For compatibility with git, '#' after a whitespace is a literal part of the filename.
| * ignore: test that leading whitespace is significantEdward Thomson2019-05-242-0/+1294
|/ | | | | | Ensure that leading whitespace is treated as being part of the filename, eg ` foo` in an ignore file indicates that a file literally named ` foo` is ignored.
* Merge pull request #5088 from pks-t/pks/cache-eviction-segfaultEdward Thomson2019-05-242-2/+9
|\ | | | | cache: fix cache eviction using deallocated key
| * cache: fix cache eviction using deallocated keyPatrick Steinhardt2019-05-242-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When evicting cache entries, we first retrieve the object that is to be evicted, delete the object and then finally delete the key from the cache. In case where the cache eviction caused us to free the cached object, though, its key will point to invalid memory now when trying to remove it from the cache map. On my system, this causes us to not properly remove the key from the map, as its memory has been overwritten already and thus the key lookup it will fail and we cannot delete it. Fix this by only decrementing the refcount of the evictee after we have removed it from our cache map. Add a test that caused a segfault previous to that change.
* | Merge pull request #5085 from pks-t/pks/security.mdPatrick Steinhardt2019-05-242-3/+15
|\ \ | |/ |/| SECURITY.md: split out security-relevant bits from readme
| * SECURITY.md: split out security-relevant bits from readmePatrick Steinhardt2019-05-242-3/+15
| | | | | | | | | | | | | | | | | | | | GitHub has recently introduced a new set of tools that aims to ease the process around vulnerability reports and security fixes. Part of those tools is a new security tab for projects that will display contents from a new SECURITY.md file. Move relevant parts from README.md to this new file to make use of this feature.
* | Merge pull request #5086 from jacquesg/netbsdEdward Thomson2019-05-241-1/+1
|\ \ | |/ |/| Restore NetBSD support
| * NetBSD < 7 doesn't have posix_fallocateJacques Germishuys2019-05-241-1/+1
|/ | | | See: https://www.netbsd.org/changes/changes-7.0.html
* Merge pull request #5084 from eaigner/garbage-valuePatrick Steinhardt2019-05-241-1/+1
|\ | | | | repository: fix garbage return value
| * repository: fix garbage return valueErik Aigner2019-05-231-1/+1
|/ | | error was never initialized and a garbage value returned on success.
* Merge pull request #5083 from libgit2/ethomson/pcre_warningsEdward Thomson2019-05-231-0/+1
|\ | | | | cmake: disable fallthrough warnings for PCRE
| * cmake: disable fallthrough warnings for PCREethomson/pcre_warningsEdward Thomson2019-05-221-0/+1
|/ | | | | Our PCRE dependency has uncommented fallthroughs in switch statements. Turn off warnings for those in the PCRE code.
* Merge pull request #5073 from libgit2/ethomson/config_section_validityEdward Thomson2019-05-222-22/+98
|\ | | | | Configuration parsing: validate section headers with quotes
| * config: rename subsection header parser funcethomson/config_section_validityEdward Thomson2019-05-221-2/+2
| | | | | | | | | | | | The `parse_section_header_ext` name suggests that it as an extended function for parsing the section header. It is not. Rename it to `parse_subsection_header` to better reflect its true mission.
| * config: validate quoted section valueEdward Thomson2019-05-222-10/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | When we reach a whitespace after a section name, we assume that what will follow will be a quoted subsection name. Pass the current position of the line being parsed to the subsection parser, so that it can validate that subsequent characters are additional whitespace or a single quote. Previously we would begin parsing after the section name, looking for the first quotation mark. This allows invalid characters to embed themselves between the end of the section name and the first quotation mark, eg `[section foo "subsection"]`, which is illegal.
| * config: don't write invalid columnEdward Thomson2019-05-221-2/+9
| | | | | | | | | | When we don't specify a particular column, don't write it in the error message. (column "0" is unhelpful.)
| * config: lowercase error messagesEdward Thomson2019-05-221-10/+10
|/ | | | | Update the configuration parsing error messages to be lower-cased for consistency with the rest of the library.
* Merge pull request #5060 from pks-t/pks/refspec-nested-globsEdward Thomson2019-05-224-36/+49
|\ | | | | Loosen restriction on wildcard "*" refspecs
| * refspec: fix transforming nested starsPatrick Steinhardt2019-04-262-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-263-23/+38
| | | | | | | | | | | | | | | | | | | | | | | | 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
| |
* | Merge pull request #4935 from libgit2/ethomson/pcreEdward Thomson2019-05-2167-12195/+47608
|\ \ | | | | | | Use PCRE for our fallback regex engine when regcomp_l is unavailable
| * | ci: use a mix of regex backendsEdward Thomson2019-05-212-6/+6
| | | | | | | | | | | | | | | Explicitly enable the `builtin` regex backend and the PCRE backend for some Linux builds.
| * | regex: use REGEX_BACKEND as the cmake option nameEdward Thomson2019-05-212-11/+11
| | | | | | | | | | | | This avoids any misunderstanding with the REGEX keyword in cmake.
| * | regex: optionally use PCRE2Edward Thomson2019-05-195-2/+55
| | | | | | | | | | | | | | | | | | | | | Use PCRE2 and its POSIX compatibility layer if requested by the user. Although PCRE2 is adequate for our needs, the PCRE2 POSIX layer as installed on Debian and Ubuntu systems is broken, so we do not opt-in to it by default to avoid breaking users on those platforms.
| * | regex: use system PCRE if availableEdward Thomson2019-05-193-4/+54
| | | | | | | | | | | | | | | Attempt to locate a system-installed version of PCRE and use its POSIX compatibility layer, if possible.
| * | regex: disambiguate builtin vs system pcreEdward Thomson2019-05-193-2/+3
| | |
| * | regex: allow regex selection in cmakeEdward Thomson2019-05-194-45/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users can now select which regex implementation they want to use: one of the system `regcomp_l`, the system PCRE, the builtin PCRE or the system's `regcomp`. By default the system `regcomp_l` will be used if it exists, otherwise the system PCRE will be used. If neither of those exist, then the builtin PCRE implementation will be used. The system's `regcomp` is not used by default due to problems with locales.
| * | core::posix: skip some locale tests on win32Edward Thomson2019-05-191-7/+18
| | |
| * | win32: move type definitions for improved inclusionEdward Thomson2019-05-194-103/+129
| | | | | | | | | | | | | | | Move some win32 type definitions to a standalone file so that they can be included before other header files try to use the definitions.
| * | regex: don't warn on unused functionsEdward Thomson2019-05-191-0/+2
| | | | | | | | | | | | PCRE includes compatibility functions that may go unused. Don't warn.
| * | tests: regcomp: use proper character classesEdward Thomson2019-05-191-2/+2
| | | | | | | | | | | | | | | The '[[:digit:]]' and '[[:alpha:]]' classes require double brackets, not single.
| * | tests: regcomp: test that regex functions succeedEdward Thomson2019-05-191-9/+9
| | | | | | | | | | | | | | | The regex functions return nonzero (not necessarily negative values) on failure.
| * | tests: regcomp: assert character groups do match normal alphabetPatrick Steinhardt2019-05-191-0/+42
| | | | | | | | | | | | | | | | | | In order to avoid us being unable to match characters which are part of the normal US alphabet in certain weird languages, add two tests to catch this behavior.
| * | tests: regex: restructure setup of localesPatrick Steinhardt2019-05-191-34/+29
| | | | | | | | | | | | | | | | | | In order to make it easier adding more locale-related tests, add a generalized framework handling initial setup of languages as well as the cleanup of them afterwards.
| * | tests: regex: add test with LC_COLLATE being setEdward Thomson2019-05-191-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | While we already have a test for `p_regexec` with `LC_CTYPE` being modified, `regexec` also alters behavior as soon as `LC_COLLATE` is being modified. Most importantly, `LC_COLLATE` changes the way how ranges are interpreted to just not handling them at all. Thus, ensure that either we use `regcomp_l` to avoid this, or that we've fallen back to our builtin regex functionality which also behaves properly.
| * | tests: fix p_regcomp test not checking return typePatrick Steinhardt2019-05-191-1/+1
| | | | | | | | | | | | | | | While the test asserts that the error value indcates a non-value, it is actually never getting assigned to. Fix this.
| * | diff_driver: detect memory allocation errors when loading diff driverPatrick Steinhardt2019-05-191-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When searching for a configuration key for the diff driver, we construct the config key by modifying a buffer and then passing it to `git_config_get_multivar_foreach`. We do not check though whether the modification of the buffer actually succeded, so we could in theory end up passing the OOM buffer to the config function. Fix that by checking return codes. While at it, switch to use `git_buf_PUTS` to avoid repetition of the appended string to calculate its length.
| * | regexec: use pcre as our fallback/builtin regexEdward Thomson2019-05-1946-11987/+47138
| | | | | | | | | | | | | | | | | | | | | Use PCRE 8.42 as the builtin regex implementation, using its POSIX compatibility layer. PCRE uses ASCII by default and the users locale will not influence its behavior, so its `regcomp` implementation is similar to `regcomp_l` with a C locale.
| * | fuzzers: use system includesEdward Thomson2019-05-191-0/+1
| | | | | | | | | | | | | | | | | | Use the system includes (defined by libgit2) as the fuzzer includes. The fuzzers link against internal libgit2 API and therefore need to have the full include path that libgit2 uses.
| * | regexec: prefix all regexec function calls with p_Edward Thomson2019-05-1912-77/+106
| | | | | | | | | | | | | | | | | | | | | Prefix all the calls to the the regexec family of functions with `p_`. This allows us to swap out all the regular expression functions with our own implementation. Move the declarations to `posix_regex.h` for simpler inclusion.
* | | Merge pull request #5062 from tiennou/fix/ssh-url-substitutionEdward Thomson2019-05-215-31/+142
|\ \ \ | | | | | | | | Remote URL last-chance resolution
| * | | remote: add callback to resolve URLs before connectingErik Aigner2019-05-215-31/+142
|/ / / | | | | | | | | | | | | | | | Since libssh2 doesn't read host configuration from the config file, this callback can be used to hand over URL resolving to the client without touching the SSH implementation itself.
* | | Merge pull request #5075 from libgit2/ethomson/ignore_skip_bomPatrick Steinhardt2019-05-212-1/+35
|\ \ \ | | | | | | | | Skip UTF8 BOM in ignore files
| * | | ignore: skip UTF8 BOM in ignore fileethomson/ignore_skip_bomEdward Thomson2019-05-191-1/+12
| | | |
| * | | ignore: test we can handle an ignore file with BOMEdward Thomson2019-05-191-0/+23
| |/ / | | | | | | | | | Ensure that we can read and parse an ignore file with a UTF8 BOM.