Log

Author Commit Date CI Message
Edward Thomson 9293e165 2020-10-04T21:41:28 Merge pull request #5494 from kevinjswinton/master Fix binary diff showing /dev/null
kevinlul e8ab3db9 2020-07-07T22:29:05 p_chmod: Android compatibility Fix #5565 Pre-Android 5 did not implement a virtual filesystem atop FAT partitions for Unix permissions, which causes chmod to fail. However, Unix permissions have no effect on Android anyway as file permissions are not actually managed this way, so treating it as a no-op across all Android is safe.
Edward Thomson 2ab99c6d 2020-10-04T18:30:10 Merge pull request #5576 from lollipopman/double-auth httpclient: only free challenges for current_server type
Edward Thomson 3a72345b 2020-10-04T18:25:32 Merge pull request #5581 from libgit2/ethomson/mainbranch Respect `init.defaultBranch` setting
Edward Thomson a94fedc1 2020-10-04T18:04:01 Merge pull request #5620 from dlax/parse-patch-add-delete-no-index patch_parse: handle absence of "index" header for new/deleted cases
Edward Thomson a1f0135d 2020-10-04T18:01:09 Merge pull request #5626 from csware/parse_bool boolean config parsing fails in some cases with mapped values
Edward Thomson 36dc681e 2020-10-04T17:54:15 Merge pull request #5629 from csware/config-multiline-parse Fix config file parsing with multi line values containing quoted parts
Edward Thomson 30ba98a1 2020-10-04T17:40:38 Merge pull request #5636 from libgit2/pks-release-build-warnings Fix release build warnings
Sven Strickroth 6ac18625 2020-09-09T17:51:38 Fix config file parsing with multi line values containing quoted parts Signed-off-by: Sven Strickroth <email@cs-ware.de>
Patrick Steinhardt b254a585 2020-09-18T10:43:34 sysdir: fix formatting error message with NULL string When trying to the template dir, we pass in a `NULL` pointer for the filename. That's perfectly fine, but if we're failing to find the template directory then we'll creat an error message with the `NULL` pointer passed in. Fix the issue by setting different error messages based on whether the filename is given or not. This even makes sense, as we're not searching for a file in case we have no `name`, but for a directory. So the error would've been misleading anyway.
Patrick Steinhardt 8087498d 2020-09-18T10:49:24 Merge pull request #5631 from csware/issue-5611 Fix deprecation links inside of documentation not working
Patrick Steinhardt 37ae0079 2020-09-18T10:38:45 patch_parse: silence maybe-uninitialized warning When building libgit2 with the release build type, then GCC complains about mode being potentially uninitialized. While this seems to be a false positive, let's silence this warning by zero-initializing the mode.
Patrick Steinhardt 819492c1 2020-09-18T10:34:40 refs: fix potential free of uninitialized variable The `signature` variable in `git_reference_rename` isn't initialized and neither does `git_reference__log_signature` always do. So if the latter function fails, we'll call `git_signature_free` on this unininitialized variable. Fix the issue by initializing the pointer with `NULL`.
Patrick Steinhardt 9e81711b 2020-09-18T10:31:50 Merge pull request #5632 from csware/winhttp_typo Fix typo: Make ifndef macroname the same as the define name
Edward Thomson ae99e697 2020-09-17T11:19:49 Merge pull request #5619 from ddevault/diffstat-segfault diff stats: fix segfaults with new files
Drew DeVault ec26b16d 2020-08-29T10:44:40 diff stats: fix segfaults with new files
Edward Thomson 298b01ab 2020-09-15T09:26:08 Merge pull request #5633 from csware/winhttp1.3 WinHTTP: Try to use TLS1.3
Edward Thomson d65edcdc 2020-09-15T09:23:00 Merge pull request #5628 from interkosmos/master Fixed includes for FreeBSD
Philipp 6887e9db 2020-09-14T15:54:00 Removed FreeBSD-related macros.
Sven Strickroth 797535b6 2020-09-12T00:14:41 WinHTTP: Try to use TLS1.3 Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 090e7d85 2020-09-10T22:41:15 Fix deprecation links inside of documentation not working Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 621e501c 2020-09-10T10:32:02 Fix typo: Make ifndef macroname the same as the define name Signed-off-by: Sven Strickroth <email@cs-ware.de>
Philipp e937a2aa 2020-09-09T19:08:20 Fixed includes for FreeBSD.
Sven Strickroth c464f123 2020-09-09T15:41:12 Improve formatting Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth b97f41db 2020-09-09T15:38:20 Add boolean tests for "on" and "off" Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 36cf1db2 2020-09-09T12:26:34 Support empty values for git_config_get_mapped and git_config_lookup_map_value Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 86d04918 2020-09-09T11:55:25 Fix parsing boolean config values when using git_config_get_mapped and git_config_lookup_map_value Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson 1e987525 2020-09-08T17:25:06 Merge pull request #5624 from csware/http-upgrade-header Don't fail if a HTTP server announces he supports a protocol upgrade
Sven Strickroth 2dea3eb4 2020-09-08T13:03:07 Don't fail if a HTTP server announces he supports a protocol upgrade cf. RFC7230 section 6.7, an Upgrade header in a normal response merely informs the client that the server supports upgrading to other protocols, and the client can ask for such an upgrade in a later request. The server requiring an upgrade is via the 426 Upgrade Required response code, not the mere presence of the Upgrade response header. (closes issue #5573) Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson f29e6dde 2020-09-01T09:58:13 Merge pull request #5621 from kim/null-safe-git_net_url_is_default_port Return false instead of segfaulting when checking for default port
Kim Altintop 7e1f0b22 2020-08-31T21:54:17 Return false instead of segfaulting when checking for default port `default_port_for_scheme` returns NULL if the scheme is not one of the builtin ones. This may cause a segmentation fault if a custom transport URL happens to contain a port number, and this code path is triggered (e.g. by setting git_fetch_options->update_fetchhead to 1).
Edward Thomson a5eb7e02 2020-08-31T12:52:48 Merge pull request #5612 from mmuman/haiku deps: ntlmclient: fix htonll for Haiku
Edward Thomson 8e3f8823 2020-08-31T12:45:11 Merge pull request #5615 from libgit2/pks/azure-remove-docjob azure: Remove job generating documentation
Denis Laxalde 74293ea0 2020-08-29T16:46:47 patch_parse: handle absence of "index" header for new/deleted cases This follows up on 11de594f85479e4804b07dc4f7b33cfe9212bea0 which added support for parsing patches without extended headers (the "index <hash>..<hash> <mode>" line); issue #5267. We now allow transition from "file mode" state to "path" state directly if there is no "index", which will happen for patches adding or deleting files as demonstrated in added test case.
Edward Thomson 931bd3b8 2020-08-28T12:30:35 Merge pull request #5617 from muhkuh-sys/master Fix crash in git_describe_commit when opts are NULL.
Christoph Thelen d10c846e 2020-08-27T21:47:48 Fix crash in git_describe_commit when opts are NULL. The argument "opts" can be NULL, which selects default options. Do not access "opts" directly but only the normalized copy.
Patrick Steinhardt 7851a165 2020-08-24T12:31:08 azure: Remove job generating documentation With the recent addition of GitHub Actions to our CI infrastructure, we now have two jobs which generate documentation: once in GHA, once in Azure. Naturally, as they both want to update the same branch, they race against each other and one of both jobs will fail. Fix this by removing the documentation job from Azure.
Patrick Steinhardt da3288de 2020-08-24T11:20:50 Merge pull request #5600 from andrewhickman/fix-double-free Fix `git_mwindow_scan_recently_used` spuriously returning true
Patrick Steinhardt 24eacab9 2020-08-24T11:00:20 Merge pull request #5599 from libgit2/ethomson/zlib zstream: handle Z_BUF_ERROR appropriately in get_output_chunk
Patrick Steinhardt 8a24ee8a 2020-08-24T10:28:02 Merge pull request #5610 from SirWindfield/patch-1 docs: fix typo
François Revol 92913621 2020-08-21T23:00:59 deps: ntlmclient: #error out on unknown platforms We explicitly pass win32 & macOS, although some old version might not have it.
François Revol 49ce5e29 2020-08-21T17:34:57 deps: ntlmclient: fix htonll for Haiku Use B_HOST_TO_BENDIAN_INT64 for that.
Sven e46ef5ee 2020-08-18T14:58:21 docs: fix typo
Andrew Hickman 04d59466 2020-08-05T22:04:15 Preserve behaviour of `git_mwindow_scan_recently_used` with `*out_window` set
Andrew Hickman 8ea9187a 2020-08-05T20:22:55 Fix `git_mwindow_scan_recently_used` spuriously returning true
Edward Thomson 4d4befac 2020-08-05T10:07:23 pack: check pack_window_open return
Edward Thomson 9bb61bad 2020-08-05T09:42:52 zstream: handle Z_BUF_ERROR appropriately in get_output_chunk Our processing loop in git_zstream_get_output_chunk does not handle `Z_BUF_ERROR` appropriately at the end of a compressed window. From the zlib manual, inflate will return: > Z_BUF_ERROR if no progress was possible or if there was not enough > room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR > is not fatal, and inflate() can be called again with more input and > more output space to continue decompressing. In our loop, we were waiting until we got the expected size, then ensuring that we were at `Z_STREAM_END`. We are not guaranteed to be, since zlib may be in the `Z_BUF_ERROR` state where it has consumed a full window's worth of data, but it doesn't know that it's really at the end of the stream. There _could_ be more compressed data, but it doesn't _know_ that there's not until we make a subsequent call. We can change the loop to look for the end of stream instead of our expected size. This allows us to call inflate one last time when we are at the end of a window (and in the `Z_BUF_ERROR` state), allowing it to recognize the end of the stream, and move from the `Z_BUF_ERROR` state to the `Z_STREAM_END` state. If we do this, we need another exit condition: when `bytes == 0`, then no progress could be made and we should stop trying to inflate. This will be an error case, caught by the size and/or end-of-stream test.
Edward Thomson 0ff70f4a 2020-07-15T22:15:27 refs: remove "master" branch constant We don't use "master" as a hardcoded default in as many places; remove the now unused master branch constant.
Edward Thomson e3f065ea 2020-07-15T22:13:47 remote: update the default remote branch When the remote does not tell us its default, we have to guess what the default branch should be. Use our local initial branch configuration to inform the remote branch default when we clone.
Edward Thomson cd2f74d2 2020-07-15T21:29:56 clone: don't assume the default branch name We derive the branch name, even in our code, we shouldn't assume that the branch will be "master".
Edward Thomson 471ed794 2020-07-13T10:05:04 clone: respect init.defaultBranch when empty When cloning an empty repository, we need to guess what the branch structure should be; instead of hardcoding `master`, use the `init.defaultBranch` setting it if it provided.
Edward Thomson 84d2a035 2020-07-13T10:10:02 repo: teach isempty about default branch config The git_repository_isempty function now respects the init.defaultbranch setting (instead of hardcoding "master") to understand if a repository is empty or not.
Edward Thomson 4cc3b2cb 2020-07-13T10:08:23 repo: add git_repository_initialbranch Provide a helper function to get the initial branch for a repository, respecting the `init.defaultBranch` configuration option, if set, and returning the "default default" (currently `master`) otherwise.
Edward Thomson e411aae3 2020-07-13T08:47:15 repo: honor the init.defaultBranch setting As part of a push towards more inclusive language, git is reconsidering using "master" as the default branch name. As a first step, this setting will be configurable with the `init.defaultBranch` configuration option. Honor this during repository initialization. During initialization, we will create an initial branch: 1. Using the `initial_head` setting, if specified; 2. Using the `HEAD` configured in a template, if it exists; 3. Using the `init.defaultBranch` configuration option, if it is set; or 4. Using `master` in the absence of additional configuration.
Edward Thomson c71321a0 2020-08-03T11:53:03 Merge pull request #5596 from libgit2/ethomson/sanitizer_ci sanitizer ci: skip negotiate tests
Edward Thomson 6973c570 2020-08-03T11:03:19 sanitizer ci: skip negotiate tests We don't build with SPNEGO enabled on our focal-based sanitizer builds, so we need to disable the negotiate tests.
Edward Thomson 11a62973 2020-08-03T10:01:26 Merge pull request #5569 from lhchavez/ci-sanitizers Add CI support for Memory and UndefinedBehavior Sanitizers
Edward Thomson c5d41d46 2020-08-03T09:55:22 Merge pull request #5563 from pks-t/pks/worktree-heads Access HEAD via the refdb backends
Edward Thomson 52ccbc5d 2020-08-03T09:52:30 Merge pull request #5582 from libgit2/pks-config-map-optimization config_entries: Avoid excessive map operations
Patrick Steinhardt f2400a9c 2020-07-13T20:56:08 config_entries: Avoid excessive map operations When appending config entries, we currently always first get the currently existing map entry and then afterwards update the map to contain the current config value. In the common scenario where keys aren't being overridden, this is the best we can do. But in case a key gets set multiple times, then we'll also perform these two map operations. In extreme cases, hashing the map keys will thus start to dominate performance. Let's optimize the pattern by using a separately allocated map entry. Currently, we always put the current list entry into the map and update it to get any overridden multivar. As these list entries are also used to iterate config entries, we cannot update them in-place in the map and are thus forced to always set the map to contain the new entry. But with a separately allocated map entry, we can now create one once per config key and insert it into the map. Whenever appending a new config value with the same key, we can now just update the map entry in-place instead of having to replace the map entry completely. This reduces calls to the hashing function by half and trades the improved runtime for one more allocation per unique config key. Given that the refactoring arguably improves code readability by splitting concerns of the `config_entry_list` type and not having to track it in two different structures, this alone would already be reason enough to take the trade. Given a pathological case of a gitconfig with 100.000 repeated keys and a section of length 10.000 characters, this reduces runtime by half from approximately 14 seconds to 7 seconds as expected.
Edward Thomson a83fd510 2020-07-12T21:26:59 Merge pull request #5396 from lhchavez/mwindow-file-limit mwindow: set limit on number of open files
lhchavez 92d42eb3 2020-07-12T09:53:10 Minor nits and style formatting
Patrick Steinhardt ce4cb073 2020-07-12T18:19:21 tests: verify renaming branch really updates worktree HEAD In case where a branch is getting renamed, all HEADs of the main repository and of its worktrees that point to the old branch need to get updated to point to the new branch. We already do so and have a test for this, but the test only verifies that we're able to lookup the updated HEAD, not what it contains. Let's make the test more specific by verifying the updated HEAD also has the correct updated symbolic target.
Patrick Steinhardt 5434f9a3 2020-06-17T14:57:13 refs: remove function to read HEAD directly With the last user of `git_reference__read_head` gone, let's remove it as it's been reading references without consulting the refdb backends.
Patrick Steinhardt 65895410 2020-06-17T14:56:36 repository: retrieve worktree HEAD via refdb The function `git_repository_head_for_worktree` currently uses `git_reference__read_head` to directly read a given worktree's HEAD from the filesystem. This is broken in case the repository uses a different refdb implementation than the filesystem-based one, so let's instead open the worktree as a real repository and use `git_reference_lookup`. This also fixes the case where the worktree's HEAD is not a symref, but a detached HEAD, which would have resulted in an error previously.
Patrick Steinhardt d1f210fc 2020-06-17T15:09:49 repository: remove function to iterate over HEADs The function `git_repository_foreach_head` is broken, as it directly interacts with the on-disk representation of the reference database, thus assuming that no other refdb is used for the given repository. As this is an internal function only and all users have been replaced, let's remove this function.
Patrick Steinhardt ac5fbe31 2020-06-17T14:43:27 branch: determine whether a branch is checked out via refdb We currently determine whether a branch is checked out via `git_repository_foreach_head`. As this function reads references directly from the disk, it breaks our refdb abstraction in case the repository uses a different reference backend implementation than the filesystem-based one. So let's use `git_repository_foreach_worktree` instead -- while it's less efficient, it is at least correct in all corner cases.
Patrick Steinhardt 7216b048 2020-06-17T14:23:15 refs: update HEAD references via refdb When renaming a reference, we need to iterate over every HEAD and potentially update it in case it is a symbolic reference pointing to the previous name of the renamed reference. Most importantly, this doesn't only include HEADs from the repo we're renaming the reference in, but we also need to iterate over HEADs from linked worktrees. In order to update the HEADs, we directly read them from the worktree's gitdir and thus assume that both repository and worktrees use the filesystem-based reference backend. But this breaks as soon as one got a repository with a different refdb and breaks our own abstractions. So let's instead update HEAD references via the refdb by first opening each worktree as a repository and then using the usual functions to read and update HEADs. This is a lot less efficient than the current code, but it's not like we can really help this: going via the refdb is mandatory.
Patrick Steinhardt 2fcb4f28 2020-06-17T14:09:04 repository: introduce new function to iterate over all worktrees Given a Git repository, it's non-trivial to iterate over all worktrees that are associated with it, including the "main" repository. This commit adds a new internal function `git_repository_foreach_worktree` that does this for us.
Edward Thomson 26b9e489 2020-07-12T17:04:29 Merge pull request #5570 from libgit2/pks/refdb-refactorings refdb: a set of preliminary refactorings for the reftable backend
Patrick Steinhardt 34987447 2020-06-30T10:13:26 refdb: avoid unlimited spinning in case of symref cycles To determine whether another reflog entry needs to be written for HEAD on a reference update, we need to see whether HEAD directly or indirectly points to the reference we're updating. The resolve logic is currently completely unbounded except an error occurs, which effectively means that we'd be spinning forever in case we have a symref loop in the repository refdb. Let's fix the issue by using `git_refdb_resolve` instead, which is always bounded.
Patrick Steinhardt b895547c 2020-06-30T09:35:21 refs: replace reimplementation of reference resolver The refs code currently has a second implementation that resolves references in order to find any final symbolic reference pointing to a nonexistent target branch. As we've just extended `git_refdb_resolve` to also return such references, let's use that one instead in order to reduce code duplication.
Patrick Steinhardt cf7dd05b 2020-06-30T13:26:05 refdb: return resolved symbolic refs pointing to nonexistent refs In some cases, resolving references requires us to also know about the final symbolic reference that's pointing to a nonexistent branch, e.g. in an empty repository where the main branch is yet unborn but HEAD already points to it. Right now, the resolving logic is thus split up into two, where one is the new refdb implementation and the second one is an ad-hoc implementation inside "refs.c". Let's extend `git_refdb_resolve` to also return such final dangling references pointing to nonexistent branches so we can deduplicate the resolving logic.
Patrick Steinhardt c54f40e4 2020-06-30T09:28:12 refs: move resolving of references into the refdb Resolving of symbolic references is currently implemented inside the "refs" layer. As a result, it's hard to call this function from low-level parts that only have a refdb available, but no repository, as the "refs" layer always operates on the repository-level. So let's move the function into the generic "refdb" implementation to lift this restriction.
Patrick Steinhardt ae30009e 2020-07-12T16:01:15 Merge pull request #5547 from pks-t/pks/cmake-modernization-pt2 CMake modernization pt2
Patrick Steinhardt 9703d26f 2020-06-29T12:22:27 tests: reflog: remove unused signature There's two tests that create a commit signature, but never make any use of it. Let's remove these to avoid any confusion.
Patrick Steinhardt 1f39593b 2020-06-30T08:53:59 refdb: extract function to check whether to append HEAD to the reflog The logic to determine whether a reflog entry should be for the HEAD reference is non-trivial. Currently, the only user of this is the filesystem-based refdb, but with the advent of the reftable refdb we're going to add a second user that's interested in having the same behaviour. Let's pull out a new function that checks whether a given reference should cause a entry to be written to the HEAD reflog as a preparatory step.
Patrick Steinhardt e02478b1 2020-06-05T08:17:03 refdb: extract function to check whether a reflog should be written The logic to determine whether a reflog should be written is non-trivial. Currently, the only user of this is the filesystem-based refdb, but with the advent of the reftable refdb we're going to add a second user that's interested in having the same behaviour. Let's pull out a new function that checks whether a given reference should cause a reflog to be written as a preparatory step.
Patrick Steinhardt 9bc6e655 2020-06-05T11:37:30 cmake: remove CheckPrototypeDefinition module In the past, we've imported the CheckPrototypeDefinition into our own module directory as it wasn't yet available in all supported CMake versions. Now that we require at least CMake v3.5, we don't need to bundle it anymore as it's included with the distribution already. Let's drop the included modules and always use upstream's version.
Patrick Steinhardt 4218403e 2020-06-05T10:49:09 cmake: use target-specific compile definitions We set up some compile definitions as part of our src/CMakeLists.txt. While the definitions are global, we really only need them as part of the git2internal target which compiles all the objects. Let's thus use `target_compile_definitions` instead of `add_definitions`.
Patrick Steinhardt 53911edd 2020-06-05T10:24:30 cmake: use git2internal target to populate sources Modern CMake is usually target-driven in that a target is first defined and then the likes of `target_sources`, `target_include_directories` etc. are used to further populate the target. We still use old-style CMake, where we first set up a set of variables and then populate the target in a single call. Let's migrate to modern CMake usage by starting to populate the sources of our git2internal target piece-by-piece. While this is a small step, it allows us to convert to target-based build instructions piece-by-piece.
Patrick Steinhardt 19eb1e4b 2020-06-05T10:07:33 cmake: specify project version We currently do not set up a project version within CMake, meaning that it can't be use by other projects including libgit2 as a sub-project and also not by other tools like IDEs. This commit changes this to always set up a project version, but instead of extracting it from the "version.h" header we now set it up directly. This is mostly to avoid mis-use of the previous `LIBGIT2_VERSION` variables, as we should now always use the `libgit2_VERSION` ones that are set up by CMake if one provides the "VERSION" keyword to the `project()` call. While this is one more moving target we need to adjust on releases, this commit also adjusts our release script to verify that the project version was incremented as expected.
Jesse Hathaway bd346313 2020-07-10T15:37:08 httpclient: only free challenges for current_server type Prior to this commit we freed both the server and proxy auth challenges in git_http_client_read_response. This works when the proxy needs auth or when the server needs auth, but it does not work when both the proxy and the server need auth as we erroneously remove the server auth challenge before we have added them as server credentials. Instead only remove the challenges for the current_server type. Co-authored-by: Stephen Gelman <ssgelm@gmail.com>
lhchavez 6a917c04 2020-06-28T15:51:43 Add CI support for Memory and UndefinedBehavior Sanitizers This change adds two new build targets: MSan and UBSan. This is because even though OSS-Fuzz is great and adds a lot of coverage, it only does that for the fuzz targets, so the rest of the codebase is not necessarily run with the Sanitizers ever :( So this change makes sure that MSan/UBSan warnings don't make it into the codebase. As part of this change, the Ubuntu focal container is introduced. It builds mbedTLS and libssh2 as debug libraries into /usr/local and as MSan-enabled libraries into /usr/local/msan. This latter part is needed because MSan requires the binary and all its dependent libraries to be built with MSan support so that memory allocations and deallocations are tracked correctly to avoid false positives.
Edward Thomson 325375e3 2020-07-09T23:12:58 Merge pull request #5568 from lhchavez/ubsan Make the tests run cleanly under UndefinedBehaviorSanitizer
Edward Thomson 2ffa426e 2020-07-09T23:02:05 Merge pull request #5567 from lhchavez/msan Make the tests pass cleanly with MemorySanitizer
Edward Thomson 60536163 2020-07-09T22:56:44 Merge pull request #5561 from A-Ovchinnikov-mx/a-ovchin/windres-rc Enable building git2.rc resource script with GCC
Edward Thomson 8720ae8a 2020-07-02T11:45:16 Merge pull request #5571 from lhchavez/ntlmclient-sanitizers Make NTLMClient Memory and UndefinedBehavior Sanitizer-clean
Alexander Ovchinnikov dc1deb3b 2020-07-01T15:41:38 Use __GNUC__ macro in the resource script Fix the default LIBGIT2_FILENAME for GNU windres
Alexander Ovchinnikov 71000441 2020-06-16T18:58:07 Review: Rename the stringize macro
Alexander Ovchinnikov 5c40456b 2020-06-16T13:19:02 Enable building git2.rc resource script with GCC
lhchavez 7c964416 2020-06-30T05:46:47 Make NTLMClient Memory and UndefinedBehavior Sanitizer-clean This change makes the code pass the libgit2 tests cleanly when MSan/UBSan are enabled. Notably: * Changes malloc/memset combos into calloc for easier auditing. * Makes `write_buf` return early if the buffer length is empty to avoid arithmetic with NULL pointers (which UBSan does not like). * Initializes a few arrays that were sometimes being read before being written to.
lhchavez 3a197ea7 2020-06-27T12:33:32 Make the tests pass cleanly with MemorySanitizer This change: * Initializes a few variables that were being read before being initialized. * Includes https://github.com/madler/zlib/pull/393. As such, it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
lhchavez d0656ac8 2020-06-27T12:15:26 Make the tests run cleanly under UndefinedBehaviorSanitizer This change makes the tests run cleanly under `-fsanitize=undefined,nullability` and comprises of: * Avoids some arithmetic with NULL pointers (which UBSan does not like). * Avoids an overflow in a shift, due to an uint8_t being implicitly converted to a signed 32-bit signed integer after being shifted by a 32-bit signed integer. * Avoids a unaligned read in libgit2. * Ignores unaligned reads in the SHA1 library, since it only happens on Intel processors, where it is _still_ undefined behavior, but the semantics are moderately well-understood. Of notable omission is `-fsanitize=integer`, since there are lots of warnings in zlib and the SHA1 library which probably don't make sense to fix and I could not figure out how to silence easily. libgit2 itself also has ~100s of warnings which are mostly innocuous (e.g. use of enum constants that only fit on an `uint32_t`, but there is no way to do that in a simple fashion because the data type chosen for enumerated types is implementation-defined), and investigating whether there are worrying warnings would need reducing the noise significantly.
lhchavez d88994da 2020-06-27T07:34:36 Create the repository within the test This change moves the humongous static repository with 1025 commits into the test file, now with a more modest 16 commits.
lhchavez eab2b044 2020-06-26T16:10:30 Review feedback * Change the default of the file limit to 0 (unlimited). * Changed the heuristic to close files to be the file that contains the least-recently-used window such that the window is the most-recently-used in the file, and the file does not have in-use windows. * Parameterized the filelimit test to check for a limit of 1 and 100 open windows.
Edward Thomson d6c62852 2020-06-23T09:16:05 Merge pull request #5559 from pks-t/pks/diff-print-fixups Random fixes for diff-printing
lhchavez 9679df57 2020-02-08T20:47:24 mwindow: set limit on number of open files There are some cases in which repositories accrue a large number of packfiles. The existing mwindow limit applies only to the total size of mmap'd files, not on their number. This leads to a situation in which having lots of small packfiles could exhaust the allowed number of open files, particularly on macOS, where the default ulimit is very low (256). This change adds a new configuration parameter (GIT_OPT_SET_MWINDOW_FILE_LIMIT) that sets the maximum number of open packfiles, with a default of 128. This is low enough so that even macOS users should not hit it during normal use. Based on PR #5386, originally written by @josharian. Fixes: #2758
Patrick Steinhardt d43d490c 2020-06-17T17:51:19 Merge pull request #5419 from lhchavez/fix-git_index_add_from_buffer-docs index: Update the documentation for git_index_add_from_buffer()
Patrick Steinhardt 6256d023 2020-06-15T14:34:29 diff_print: adjust code to match current coding style