summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | | Merge pull request #5080 from dbrnz/issue-5079Patrick Steinhardt2019-05-211-1/+0
|\ \ \ | | | | | | | | We've already added `ZLIB_LIBRARIES` to `LIBGIT2_LIBS` so don't also add the `z` library
| * | | Use tabs for indentation (#5079).David Brooks2019-05-211-5/+5
| | | |
| * | | Fix indentation (#5079).David Brooks2019-05-211-5/+5
| | | |
| * | | We still need to update pkgconfig variables when zlib is unbundled (#5079).David Brooks2019-05-211-0/+5
| | | |
| * | | We've already added `ZLIB_LIBRARIES` to `LIBGIT2_LIBS` so don't also add the ↵David Brooks2019-05-211-6/+0
|/ / / | | | | | | | | | `z` library (libgit2/#5079).
* | | Merge pull request #5077 from jacquesg/symbolic_link_flag_directoryEdward Thomson2019-05-201-0/+4
|\ \ \ | |/ / |/| | Define SYMBOLIC_LINK_FLAG_DIRECTORY if required
| * | define SYMBOLIC_LINK_FLAG_DIRECTORY if not definedJacques Germishuys2019-05-201-0/+4
|/ /
* | Merge branch 'pr/5061'Edward Thomson2019-05-122-1/+26
|\ \
| * | revwalk: update error message for clarityEdward Thomson2019-05-121-1/+1
| | |
| * | revwalk: fix memory leak in error handlingHeiko Voigt2019-05-102-1/+11
| | | | | | | | | | | | | | | This is not implemented and should fail, but it should also not leak. To allow the memory debugger to find leaks and fix this one we test this.
| * | git_revwalk_push_range: do not crash if range is missingHeiko Voigt2019-05-032-0/+15
| | | | | | | | | | | | | | | If someone passes just one ref (i.e. "master") and misses passing the range we should be nice and return an error code instead of crashing.
* | | Merge pull request #5065 from danielgindi/feature/win32_symlink_dirEdward Thomson2019-05-121-2/+7
|\ \ \ | | | | | | | | Support symlinks for directories in win32
| * | | Moved dwFlags declaration to beginning of scopeDaniel Cohen Gindi2019-05-061-1/+2
| | | |
| * | | Support symlinks for directories in win32Daniel Cohen Gindi2019-05-051-2/+6
| | | |
* | | | Merge pull request #5057 from eaigner/merge-rebase-onto-nameEdward Thomson2019-05-123-0/+54
|\ \ \ \ | |/ / / |/| | | rebase: orig_head and onto accessors