- 19 May, 2019 14 commits
-
-
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.
Edward Thomson committed -
Edward Thomson committed
-
Move some win32 type definitions to a standalone file so that they can be included before other header files try to use the definitions.
Edward Thomson committed -
PCRE includes compatibility functions that may go unused. Don't warn.
Edward Thomson committed -
The '[[:digit:]]' and '[[:alpha:]]' classes require double brackets, not single.
Edward Thomson committed -
The regex functions return nonzero (not necessarily negative values) on failure.
Edward Thomson committed -
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.
Patrick Steinhardt committed -
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.
Patrick Steinhardt committed -
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.
Edward Thomson committed -
While the test asserts that the error value indcates a non-value, it is actually never getting assigned to. Fix this.
Patrick Steinhardt committed -
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.
Patrick Steinhardt committed -
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.
Edward Thomson committed -
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.
Edward Thomson committed -
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.
Edward Thomson committed
-
- 12 May, 2019 4 commits
-
-
Edward Thomson committed
-
Edward Thomson committed
-
Support symlinks for directories in win32
Edward Thomson committed -
rebase: orig_head and onto accessors
Edward Thomson committed
-
- 10 May, 2019 1 commit
-
-
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.
Heiko Voigt committed
-
- 06 May, 2019 1 commit
-
-
Daniel Cohen Gindi committed
-
- 05 May, 2019 1 commit
-
-
Daniel Cohen Gindi committed
-
- 03 May, 2019 1 commit
-
-
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.
Heiko Voigt committed
-
- 02 May, 2019 4 commits
-
-
cmake: correctly detect if system provides `regcomp`
Patrick Steinhardt committed -
Correctly write to missing locked global config
Patrick Steinhardt committed -
When linking against bundled libraries, we include their header directories by using "-isystem". The reason for that is that we want to handle our vendored library headers specially, most importantly to ignore warnings generated by including them. By using "-isystem", though, we screw up the order of searched include directories by moving those bundled dependencies towards the end of the lookup order. Like this, chances are high that any other specified include directory contains a file that collides with the actual desired include file. Fix this by not treating the bundled dependencies' include directories as system includes. This will move them to the front of the lookup order and thus cause them to override system-provided headers. While this may cause the compiler to generate additional warnings when processing bundled headers, this is a tradeoff we should make regardless to fix builds on systems hitting this issue.
Patrick Steinhardt committed -
We assume that if we are on Win32, Amiga OS, Solaris or SunOS, that the regcomp(3P) function cannot be provided by the system. Thus we will in these cases always include our own, bundled regex sources to make a regcomp implementation available. This test is obviously very fragile, and we have seen it fail on MSYS2/MinGW systems, which do in fact provide the regcomp symbol. The effect is that during compilation, we will use the "regex.h" header provided by MinGW, but use symbols provided by ourselves. This in fact may cause subtle memory layout issues, as the structure made available via MinGW doesn't match what our bundled code expects. There's one more problem with our regex detection: on the listed platforms, we will incorrectly include the bundled regex code even in case where the system provides regcomp_l(3), but it will never be used for anything. Fix the issue by improving our regcomp detection code. Instead of relying on a fragile listing of platforms, we can just use `CHECK_FUNCTION_EXISTS` instead. This will not in fact avoid the header-ordering problem. But we can assume that as soon as a system-provided "regex.h" header is provided, that `CHECK_FUNCTION_EXISTS` will now correctly find the desired symbol and thus not include our bundled regex code.
Patrick Steinhardt committed
-
- 30 Apr, 2019 1 commit
-
-
Opening a default config when ~/.gitconfig doesn't exist, locking it, and attempting to write to it causes an assertion failure. Treat non-existent global config file content as an empty string.
Ian Hattendorf committed
-
- 29 Apr, 2019 1 commit
-
-
[RFC] util: introduce GIT_DOWNCAST macro
Patrick Steinhardt committed
-
- 26 Apr, 2019 1 commit
-
-
examples: implement SSH authentication
Patrick Steinhardt committed
-
- 21 Apr, 2019 1 commit
-
-
The rebase struct stores fields with information about the current rebase process, which were not accessible via a public interface. Accessors for getting the `orig_head` and `onto` branch names and object ids have been added.
Erik Aigner committed
-
- 17 Apr, 2019 2 commits
-
-
git_repository_init: stop traversing at windows root
Edward Thomson committed -
Stop traversing the filesystem at the Windows directory root. We were calculating the filesystem root for the given directory to create, and walking up the filesystem hierarchy. We intended to stop when the traversal path length is equal to the root path length (ie, stopping at the root, since no path may be shorter than the root path). However, on Windows, the root path may be specified in two different ways, as either `Z:` or `Z:\`, where `Z:` is the current drive letter. `git_path_dirname_r` returns the path _without_ a trailing slash, even for the Windows root. As a result, during traversal, we need to test that the traversal path is _less than or equal to_ the root path length to determine if we've hit the root to ensure that we stop when our traversal path is `Z:` and our calculated root path was `Z:\`.
Edward Thomson committed
-
- 16 Apr, 2019 8 commits
-
-
config_file: check result of git_array_alloc
Edward Thomson committed -
git_array_alloc can return NULL if no memory is available, causing a segmentation fault in memset. This adds GIT_ERROR_CHECK_ALLOC similar to how other parts of the code base deal with the return value of git_array_alloc.
Tobias Nießen committed -
Etienne Samson committed
-
Etienne Samson committed
-
Etienne Samson committed
-
Patrick Steinhardt committed
-
In some parts of our code, we make rather heavy use of casting structures to their respective specialized implementation. One example is the configuration code with the general `git_config_backend` and the specialized `diskfile_header` structures. At some occasions, it can get confusing though with regards to the correct inheritance structure, which led to the recent bug fixed in 2424e64c (config: harden our use of the backend objects a bit, 2018-02-28). Object-oriented programming in C is hard, but we can at least try to have some checks when it comes to casting around stuff. Thus, this commit introduces a `GIT_CONTAINER_OF` macro, which accepts as parameters the pointer that is to be casted, the pointer it should be cast to as well as the member inside of the target structure that is the containing structure. This macro then tries hard to detect mis-casts: - It checks whether the source and target pointers are of the same type. This requires support by the compiler, as it makes use of the builtin `__builtin_types_compatible_p`. - It checks whether the embedded member of the target structure is the first member. In order to make this a compile-time constant, the compiler-provided `__builtin_offsetof` is being used for this. - It ties these two checks together by the compiler-builtin `__builtin_choose_expr`. Based on whether the previous two checks evaluate to `true`, the compiler will either compile in the correct cast, or it will output `(void)0`. The second case results in a compiler error, resulting in a compile-time check for wrong casts. The only downside to this is that it relies heavily on compiler-specific extensions. As both GCC and Clang support these features, only define this macro like explained above in case `__GNUC__` is set (Clang also defines `__GNUC__`). If the compiler is not Clang or GCC, just go with a simple cast without any additional checks.
Patrick Steinhardt committed -
patch_parse.c: Handle CRLF in parse_header_start
Patrick Steinhardt committed
-