summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* trace: suffix the callbacks with `_cb`ethomson/callback_namesEdward Thomson2019-06-104-5/+20
| | | | | The trace logging callbacks should match the other callback naming conventions, using the `_cb` suffix instead of a `_callback` suffix.
* credentials: suffix the callbacks with `_cb`Edward Thomson2019-06-103-8/+23
| | | | | The credential callbacks should match the other callback naming conventions, using the `_cb` suffix instead of a `_callback` suffix.
* Merge pull request #5095 from pks-t/pks/ignore-escaped-trailing-spaceEdward Thomson2019-06-062-3/+65
|\ | | | | ignore: handle escaped trailing whitespace
| * ignore: handle escaped trailing whitespacePatrick Steinhardt2019-06-062-2/+50
| | | | | | | | | | | | | | | | | | | | The gitignore's pattern format specifies that "Trailing spaces are ignored unless they are quoted with backslash ("\")". We do not honor this currently and will treat a pattern "foo\ " as if it was "foo\" only and a pattern "foo\ \ " as "foo\ \". Fix our code to handle those special cases and add tests to avoid regressions.
| * attr_file: refactor stripping of trailing spacesPatrick Steinhardt2019-06-061-3/+17
| | | | | | | | | | | | | | | | | | | | | | The stripping of trailing spaces currently happens as part of `git_attr_fnmatch__parse`. As we aren't currently parsing trailing whitespaces correct in case they're escaped, we'll have to change that code, though. To make actual behavioural change easier to review, refactor the code up-front by pulling it out into its own function that is expected to retain the exact same functionality as before. Like this, the fix will be trivial to apply.
* | Merge pull request #5074 from libgit2/ethomson/ignore_leading_slashEdward Thomson2019-06-062-1/+26
|\ \ | |/ |/| Ignore: only treat one leading slash as a root identifier
| * ignore: only skip first leading slashethomson/ignore_leading_slashEdward Thomson2019-05-191-1/+2
| | | | | | | | | | | | | | For compatibility with git, only skip the first leading slash in an ignore file. That is: `/a.txt` indicates to ignore a file named `a.txt` at the root. However `//b.txt` does not indicate that a file named `b.txt` at the root should be ignored.
| * ignore: test multiple leading slashesEdward Thomson2019-05-191-0/+24
| |
* | Merge pull request #5094 from libgit2/ethomson/auth_failureEdward Thomson2019-06-051-1/+1
|\ \ | | | | | | online tests: use gitlab for auth failures
| * | 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.