summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* badssl: RC4 should not fail with ECERTIFICATEcmn/rc4Edward Thomson2020-12-141-4/+2
| | | | | | Using RC4 is not a _certificate_ problem, it's a cipher problem. The SSL implementation should and will fail with an unrecoverable error (-1). There's no opportunity to accept/continue.
* badssl: re-enable RC4 testCarlos Martín Nieto2020-12-131-3/+0
| | | | | | This used to fail with an error indicating a mis-use of OpenSSL on platforms using it due to poor error handling. Re-enable it even if this isn't the right error code to use for now.
* Merge pull request #5727 from lhchavez/make-git-diff-fastEdward Thomson2020-12-134-33/+76
|\ | | | | Cache the parsed submodule config when diffing
| * Fix an oopslhchavez2020-12-111-1/+1
| |
| * Small refactor to make thing tidierlhchavez2020-12-114-43/+46
| | | | | | | | Also repurposed an unused function and deleted another one.
| * Cache the parsed submodule config when diffinglhchavez2020-12-103-8/+48
| | | | | | | | | | | | | | | | | | | | This change makes that anything that calls `git_diff__from_iterators` (any of the `git_diff_xxx` functions) only need to parse the `.gitmodules` file once. This can be avoided by calling `git_repository_submodule_cache_all(...)`, but we can do that safely for the user with no change in semantics. Fixes: #5725
* | Merge pull request #5735 from lhchavez/faster-strntol64Edward Thomson2020-12-132-11/+34
|\ \ | | | | | | Make git__strntol64() ~70%* faster
| * | Make git__strntol64() ~70%* fasterlhchavez2020-12-122-11/+34
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change uses compiler intrinsics to detect overflows instead of using divisions to detect potential overflow. This makes the code faster and makes it easier to read as a bonus side-effect! Some of the things this quickens: * Config parsing. * Tree parsing. * Smart protocol negotiation. \* Measured by running `libgit2_clar` with `-fno-optimize-sibling-calls -fno-omit-frame-pointer` under `perf(1)`: ```shell $ perf diff --symbols=git__strntol64 --compute=ratio \ --percentage=absolute baseline.data perf.data \# Event 'cycles' \# \# Baseline Ratio Shared Object \# ........ .............. ............. \# 0.25% 0.321836 libgit2_clar ```
* | Merge pull request #5384 from ianhattendorf/fix/winhttp-client-certEdward Thomson2020-12-131-26/+49
|\ \ | | | | | | winhttp: support optional client cert
| * | winhttp: clarify invalid cert caseIan Hattendorf2020-06-241-1/+1
| | |
| * | winhttp: variable and switch case scopingIan Hattendorf2020-02-061-9/+6
| | |
| * | winhttp: support optional client certIan Hattendorf2020-02-041-26/+52
| | |
* | | README: show v1.1 build statusEdward Thomson2020-12-131-1/+1
| |/ |/|
* | Merge pull request #5724 from vringar/patch-2Edward Thomson2020-12-091-2/+2
|\ \ | | | | | | git.git-authors: Replacing his/her with their
| * | git.git-authors: Replacing his/her with theirStefan Zabka2020-12-091-2/+2
|/ /
* | Merge pull request #5578 from libgit2/ethomson/friendlier_getting_startedEdward Thomson2020-12-098-4/+172
|\ \ | | | | | | Friendlier getting started in the lack of git_libgit2_init
| * | alloc: set up an allocator that fails before library initEdward Thomson2020-12-094-4/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We require the library to be initialized with git_libgit2_init before it is functional. However, if a user tries to uses the library without doing so - as they might when getting started with the library for the first time - we will likely crash. This commit introduces some guard rails - now instead of having _no_ allocator by default, we'll have an allocator that always fails, and never tries to set an error message (since the thread-local state is set up by git_libgit2_init). We've modified the error retrieval function to (try to) ensure that the library has been initialized before getting the thread-local error message. (Unfortunately, we cannot determine if the thread local storage has actually been configured, this does require initialization by git_libgit2_init. But a naive attempt should be good enough for most cases.)
| * | libgit2: provide init_count of the libraryEdward Thomson2020-12-094-0/+31
|/ / | | | | | | | | | | A function to provide the initialization count of the library; this is subject to race conditions but is useful for a naive determination as to whether the library has been initialized or not.
* | Merge pull request #5720 from libgit2/ethomson/tlsdataEdward Thomson2020-12-0932-266/+454
|\ \ | | | | | | Thread-local storage: a generic internal library (with no allocations)
| * | Replace global storage TLS with new interfaceethomson/tlsdataTyler Ang-Wanek2020-12-081-87/+15
| | |
| * | threads: git_tls_data to git_tlsdataEdward Thomson2020-12-083-168/+164
| | | | | | | | | | | | Use a no-allocation approach to the TLS data abstraction.
| * | win32: provide macros for calling conventionsEdward Thomson2020-12-083-3/+13
| | | | | | | | | | | | | | | | | | | | | Provide more clarity for Win32 calling conventions - now that we always compile to __cdecl on Win32, we'll define that as the the libgit2 calling convention. Also offer NTAPI (__stdcall) calling conventions for things that need callbacks from NTAPI code (eg fiber-local storage).
| * | Implement generic TLS interfaceTyler Ang-Wanek2020-12-062-0/+261
| | | | | | | | | | | | | | | | | | | | | | | | This adds a generic TLS interface for anyone to store TLS data. It is designed to work regardless of whether threading support is built into the library or not. Nobody in the library should directly interface with the data on the TLS struct, so it's been built to be opaque even in the library. Requires the allocator to be initialized before use.
| * | threads: rename thread files to thread.[ch]Edward Thomson2020-12-069-10/+10
| | |
| * | threads: give atomic functions the git_atomic prefixEdward Thomson2020-12-068-37/+39
| | |
| * | threads: rename git_atomic to git_atomic32Edward Thomson2020-12-0617-68/+68
| | | | | | | | | | | | | | | Clarify the `git_atomic` type and functions now that we have a 64 bit version as well (`git_atomic64`).
| * | util: move git_online_cpus into utilEdward Thomson2020-12-065-61/+52
|/ / | | | | | | | | | | The number of CPUs is useful information for creating a thread pool or a number of workers, but it's not really about threading directly. Evict it from the thread file
* | Merge pull request #5719 from libgit2/ethomson/nothreadsEdward Thomson2020-12-056-24/+34
|\ \ | | | | | | Thread-free implementation
| * | ci: run a threadsafe build in nightlyEdward Thomson2020-12-051-0/+8
| | |
| * | tests: ifdef out unused function in no-thread buildsEdward Thomson2020-12-051-0/+2
| | |
| * | packbuilder: use git__noop on non-threaded systemsEdward Thomson2020-12-051-1/+1
| | | | | | | | | | | | Our git_packbuilder__cache_lock function returns a value; use git__noop.
| * | util: move git__noop into the util headerEdward Thomson2020-12-053-23/+23
|/ / | | | | | | | | The git__noop function is more largely useful; move it into the util header. (And reduce the number of underscores.)
* | Merge pull request #5593 from lhchavez/fix-mwindow-thread-unsafetyEdward Thomson2020-11-299-140/+322
|\ \ | | | | | | Make the pack and mwindow implementations data-race-free
| * | Make the pack and mwindow implementations data-race-freelhchavez2020-11-289-140/+322
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes a packfile heap corruption that can happen when interacting with multiple packfiles concurrently across multiple threads. This is exacerbated by setting a lower mwindow open file limit. This change: * Renames most of the internal methods in pack.c to clearly indicate that they expect to be called with a certain lock held, making reasoning about the state of locks a bit easier. * Splits the `git_pack_file` lock in two: the one in `git_pack_file` only protects the `index_map`. The protection to `git_mwindow_file` is now in that struct. * Explicitly checks for freshness of the `git_pack_file` in `git_packfile_unpack_header`: this allows the mwindow implementation to close files whenever there is enough cache pressure, and `git_packfile_unpack_header` will reopen the packfile if needed. * After a call to `p_munmap()`, the `data` and `len` fields are poisoned with `NULL` to make use-after-frees more evident and crash rather than being open to the possibility of heap corruption. * Adds a test case to prevent this from regressing in the future. Fixes: #5591
* | | Merge pull request #5595 from lhchavez/odb-race-freeEdward Thomson2020-11-296-67/+235
|\ \ \ | |/ / | | | Make the odb race-free
| * | Make the odb race-freelhchavez2020-11-286-67/+235
|/ / | | | | | | | | | | | | This change adds all the necessary locking to the odb to avoid races in the backends. Part of: #5592
* | Merge pull request #5704 from lhchavez/ssh-raw-certificateEdward Thomson2020-11-272-5/+52
|\ \ | | | | | | Also add the raw hostkey to `git_cert_hostkey`
| * | Also add the raw hostkey to `git_cert_hostkey`lhchavez2020-11-272-5/+52
| | | | | | | | | | | | | | | `git_cert_x509` has the raw encoded certificate. Let's do the same for the SSH certificate for symmetry.
* | | Merge pull request #5715 from lhchavez/fix-non-debug-buildEdward Thomson2020-11-271-3/+9
|\ \ \ | |/ / |/| | Fix the `ENABLE_WERROR=ON` build in Groovy Gorilla (gcc 10.2)
| * | Fix the non-debug build in Groovy Gorilla (gcc 10.2)lhchavez2020-11-271-3/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The release build has been failing with the following error: ```shell FAILED: src/CMakeFiles/git2internal.dir/hash.c.o /usr/bin/cc -DHAVE_QSORT_R_GNU -DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\" -DSHA1DC_NO_STANDARD_INCLUDES=1 -D_FILE_OFFSET_BITS=64 -Isrc -I../src -I../include -I../deps/pcre -I../deps/http-parser -D_GNU_SOURCE -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer -Werror -Wall -Wextra -fvisibility= hidden -fPIC -Wno-documentation-deprecated-sync -Wno-missing-field-initializers -Wstrict-aliasing -Wstrict-prototypes -Wdeclaration-after-statement -Wshift-count-overflow -Wunused-const-variable -Wunused-function -Wint-conversion -Wformat -Wformat-security -Wmissing-declarations -g -D_DEBUG -O0 -std=gnu90 -MD -MT src/CMakeFiles/git2internal.dir/hash.c.o -MF s rc/CMakeFiles/git2internal.dir/hash.c.o.d -o src/CMakeFiles/git2internal.dir/hash.c.o -c ../src/hash.c ../src/hash.c: In function ‘git_hash_init’: ../src/hash.c:47:1: error: control reaches end of non-void function [-Werror=return-type] 47 | } | ^ ../src/hash.c: In function ‘git_hash_update’: ../src/hash.c:58:1: error: control reaches end of non-void function [-Werror=return-type] 58 | } | ^ ../src/hash.c: In function ‘git_hash_final’: ../src/hash.c:68:1: error: control reaches end of non-void function [-Werror=return-type] 68 | } | ^ ../src/hash.c: At top level: cc1: note: unrecognized command-line option ‘-Wno-documentation-deprecated-sync’ may have been intended to silence earlier diagnostics cc1: all warnings being treated as errors [11/533] Building C object src/CMakeFiles/git2internal.dir/odb_pack.c.o ninja: build stopped: subcommand failed. ``` The compiler _should_ be able to figure out that there is no way to reach the end of the non-void function since `GIT_ASSERT(0)` expands to either `assert()` or an unconditional `return -1;` (after doing constant folding and stuff, depending on the debug level). But it's not doing so at the moment, so let's help it.
* | Merge pull request #5447 (lhchavez:git-odb-options)Edward Thomson2020-11-275-112/+399
|\ \
| * | midx: Support multi-pack-index files in odb_pack.clhchavez2020-11-275-112/+399
|/ / | | | | | | | | | | | | | | | | | | | | | | This change adds support for reading multi-pack-index files from the packfile odb backend. This also makes git_pack_file objects open their backing failes lazily in more scenarios, since the multi-pack-index can avoid having to open them in some cases (yay!). This change also refreshes the documentation found in src/odb_pack.c to match the updated code. Part of: #5399
* | Merge pull request #5327 from libgit2/ethomson/assertEdward Thomson2020-11-27129-1120/+1744
|\ \ | | | | | | Introduce GIT_ASSERT macros
| * | win32: use GIT_ASSERTEdward Thomson2020-11-277-24/+20
| | |
| * | transports: use GIT_ASSERTEdward Thomson2020-11-2710-59/+86
| | |
| * | streams: use GIT_ASSERTEdward Thomson2020-11-276-18/+34
| | |
| * | hash: use GIT_ASSERTEdward Thomson2020-11-275-30/+33
| | |
| * | zstream: use GIT_ASSERTEdward Thomson2020-11-271-1/+1
| | |
| * | worktree: use GIT_ASSERTEdward Thomson2020-11-271-11/+19
| | |
| * | vector: use GIT_ASSERTEdward Thomson2020-11-271-19/+23
| | |