src


Log

Author Commit Date CI Message
Edward Thomson c15ed350 2021-04-26T12:23:25 repo: validate repository paths Ensure that a repository's path (at initialization or open time) is valid. On Windows systems, this means that the longest known path beneath the repository will fit within MAX_PATH: this is a lock file for a loose object within the repository itself. Other paths, like a very long loose reference, may fail to be opened after the repository is opened. These variable length paths will be checked when they are accessed themselves. This new functionality is done at open to prevent needlessly checking every file in the gitdir (eg, `MERGE_HEAD`) for its length when we could instead check once at repository open time.
Edward Thomson 3589587d 2021-04-24T13:11:25 repo: factor the commondir detection
Edward Thomson 1016ad4f 2021-04-15T01:31:12 path: don't join paths in git_path_find_dir Let `git_path_find_dir` simply take a `git_buf` that contains a directory or a file, instead of trying to both join a path AND then deal with prettifying it or its basename. This allows consumers to join paths themselves (and apply any necessary rules - like fitting within MAX_PATH).
Edward Thomson 289aaa41 2021-04-04T20:46:40 ignore: validate workdir paths for ignore files
Edward Thomson 9fb755d5 2021-04-04T19:59:57 attr: validate workdir paths for attribute files We should allow attribute files - inside working directories - to have names longer than MAX_PATH when core.longpaths is set. `git_attr_path__init` takes a repository to validate the path with.
Edward Thomson 717df1a4 2021-04-15T01:23:07 worktree: validate worktree paths Worktree paths need to fix within MAX_PATH always, regardless of `core.longpaths` setting.
Edward Thomson e52c2989 2021-04-04T19:46:08 repository: validate workdir path lengths
Edward Thomson 4470e48a 2021-04-04T14:24:35 workdir: validate working directory entry path length
Edward Thomson e5851c62 2021-04-24T09:44:45 refs: ensure loose refs adhere to path validation On Windows, we need to enforce MAX_PATH for loose references and their reflogs. Ensure that any path - including the lock file - would fit within the 260 character maximum. We do not honor core.longpaths for loose reference files or reflogs. core.longpaths only applies to paths in the working directory.
Edward Thomson f3bcadd2 2021-04-05T10:57:49 submodule: validate path lengths Validate that working directory paths honor `core.longpaths` where appropriate. Paths to the submodule gitdirs must always honor the operating system length restrictions; `core.longpaths` does not affect gitdir paths.
Edward Thomson 91156a0f 2021-04-04T10:44:29 diff: use git_repository_workdir_path The new git_repository_workdir_path function does error checking on working directory inputs on Windows; use it to construct paths within working directories.
Edward Thomson 578aeba9 2021-03-20T17:00:33 use git_repository_workdir_path to generate paths Use `git_repository_workdir_path` to generate workdir paths since it will validate the length.
Edward Thomson b457fe27 2021-04-04T22:18:55 iterator: validate workdir paths Supply the repository for the filesystem and workdir iterators - for workdir iterators, this is non-null and we can lookup the core.longpaths configuration option. (For regular filesystem iterators, this is NULL, so core.longpaths does not apply.)
Edward Thomson 99ddfd5c 2021-03-20T16:54:09 checkout: validate path length Ensure that we are validating working directory paths before we try to write to them.
Edward Thomson 6b878db5 2021-03-20T16:44:08 checkout: use target path; don't assume workdir We're not necessarily checking out into the working directory. We could be checking out into an arbitrary location. Ensure that when we are writing conflict data that we do it in the checkout target.
Edward Thomson 50e01216 2021-03-20T16:39:29 repo: introduce git_repository_workdir_path Add a simple accessor for workdir paths to get an absolute on-disk path given a repository and a relative path within it. This is useful to avoid copy-pasta `git_buf_joinpath` and to ensure that we validate working directory paths while honoring `core.longpaths` settings.
Edward Thomson dbc03de4 2021-03-20T14:28:25 apply: ensure we validate paths There was no test ensuring that we validate `.git` paths. We do, but let's add a test to make sure that we never regress this.
Edward Thomson dc1ba018 2021-03-20T13:01:00 path: introduce ondisk and workdir path validation Introduce `git_path_validate_filesystem` which validates (absolute) on-disk paths and `git_path_validate_workdir` to perform validations on (absolute) working directory paths. These functions are useful as there may be system limitations on on-disk paths, particularly on Windows (for example, enforcing MAX_PATH). For working directory paths, these limitations may be per-repository, based on the `core.longpaths` configuration setting.
Edward Thomson 88323cd0 2021-03-20T09:52:17 path: git_path_isvalid -> git_path_validate If we want to validate more and different types of paths, the name `git_path_validate` makes that easier and more expressive. We can add, for example, `git_path_validate_foo` while the current name makes that less ergonomic.
Edward Thomson cb136cdd 2021-04-14T22:22:11 utf8: introduce git_utf8_char_length Introduce a function to determine the number of Unicode characters in a given UTF-8 string.
Edward Thomson 1d95b59b 2021-04-14T15:47:27 utf8: refactor utf8 functions Move the utf8 functions into a proper namespace `git_utf8` instead of being in the namespaceless `git__` function group. Update them to have out-params first and use `char *` instead of `uint8_t *` to match our API treating strings as `char *` (even if they truly contain `uchar`s inside).
Edward Thomson 4f4b1139 2021-03-10T11:21:39 Merge pull request #5815 from libgit2/ethomson/treebuilder_write tree: deprecate `git_treebuilder_write_with_buffer`
Edward Thomson a0fca809 2021-03-10T11:19:14 Merge pull request #5814 from ianhattendorf/fix/winhttp-proxy-https winhttp: skip certificate check if unable to send request
Edward Thomson d7e65096 2021-03-04T09:44:26 Merge pull request #5764 from lhchavez/cgraph-needs-refresh commit-graph: Introduce `git_commit_graph_needs_refresh()`
Edward Thomson b99b5a81 2021-03-04T09:38:10 Merge pull request #5763 from lhchavez/cgraph-lookup commit-graph: Support lookups of entries in a commit-graph
Edward Thomson 7eb21516 2021-02-28T00:20:28 tree: deprecate `git_treebuilder_write_with_buffer` The function `git_treebuilder_write_with_buffer` is unnecessary; it is used internally as part of treebuilder writing, but it has little use to external callers. For callers that repeatedly write a treebuilder, we can supply them with a buffer in the treebuilder struct instead of recreating it. For ourselves, when we want a single buffer in our write loop, we can use an internal function.
Edward Thomson b33e018c 2021-03-04T09:20:34 Merge pull request #5818 from mamapanda/patch-3 merge: Check insert_head_ids error in create_virtual_base
Edward Thomson 80bdeca4 2021-03-04T09:18:30 Merge pull request #5817 from mamapanda/patch-2 Check git_signature_dup failure
panda dc1095a5 2021-03-03T14:42:12 merge: Check insert_head_ids error in create_virtual_base insert_head_ids can fail due to allocation error
panda b9bfe812 2021-03-03T14:03:06 Check git_signature_dup failure git_signature_dup can have an allocation failure
Ian Hattendorf edffea15 2021-03-01T16:26:58 winhttp: skip certificate check if unable to send request In some circumstances (e.g. when proxies are involved), winhttp will fail to reach the WINHTTP_CALLBACK_STATUS_SENDING_REQUEST phase. If this occurs, we'll error with ERROR_WINHTTP_INCORRECT_HANDLE_STATE when attempting to query the server certificate context (see https://docs.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpsendrequest#remarks). To avoid this, verify that WinHttpSendRequest has reached the WINHTTP_CALLBACK_STATUS_SENDING_REQUEST phase before checking the certificate. Since we're using WinHTTP in synchronous mode, we know for sure that once WinHttpSendRequest returns we've either sent it successfully or not. NOTE: WINHTTP_CALLBACK_STATUS_SENDING_REQUEST appears to be deprecated with no direct replacement. WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE is only available in async mode, and there doesn't appear to be a method of querying this flag outside of the status callback.
Edward Thomson 1bc8dec4 2021-02-28T11:02:23 Merge pull request #5797 from aaronfranke/typos Fix some typos
Edward Thomson 0fb58396 2021-02-21T20:43:51 Merge pull request #5801 from mamapanda/patch-1 index: Check git_vector_dup error in write_entries
panda 40930508 2021-02-18T16:36:42 index: Initialize case_sorted to GIT_VECTOR_INIT This is for extra safety within write_entries
panda 21981f28 2021-02-16T13:43:09 index: Check git_vector_dup error in write_entries If allocating case_sorted.contents fails, git_vector_sort will segfault.
panda 36232528 2021-02-16T13:08:02 refdb_fs: Check git_sortedcache wlock/rlock errors To prevent a race condition, these wlock/rlock calls should probably be checked for errors.
Aaron Franke 7efddeb7 2021-02-15T15:47:28 Fix some typos
Edward Thomson 02eb1711 2021-02-01T10:07:00 Merge pull request #5731 from KOLANICH-libs/owner_accessor patch: add owner accessor
Edward Thomson 2ad15250 2021-02-01T09:58:25 Merge pull request #5762 from lhchavez/cgraph-parser commit-graph: Introduce a parser for commit-graph files
Edward Thomson 0a710091 2021-02-01T09:41:42 Merge pull request #5786 from libgit2/ethomson/revparse revspec: rename git_revparse_mode_t to git_revspec_t
Edward Thomson 4732e030 2021-01-31T00:36:54 revspec: rename git_revparse_mode_t to git_revspec_t The information about the type of a revision spec is not information about the parser. Name it accordingly, so that `git_revparse_mode_t` is now `git_revspec_t`. Deprecate the old name.
lhchavez 2f382ab7 2021-01-20T04:40:40 mwindow: Fix a bug in the LRU window finding code This change now updates the `lru_window` variable to match the current file's MRU window. This makes it such that it doesn't always choose the file that happened to come last in the list of window files, and instead should now correctly choose the file with the least-recently-used one.
Edward Thomson 674875dc 2021-01-15T09:59:15 Merge pull request #5768 from lhchavez/midx-needs-refresh midx: Fix a bug in `git_midx_needs_refresh()`
Edward Thomson 487f2a82 2021-01-10T21:32:28 Merge pull request #5775 from libgit2/ethomson/clone_branch clone: set refs/remotes/origin/HEAD when branch is specified
lhchavez 1f32ed25 2021-01-04T19:33:48 commit-graph: Support lookups of entries in a commit-graph This change introduces `git_commit_graph_entry_find()` and `git_commit_graph_entry_parent()`. These two functions allow a much faster lookup of commits by ID, since the ODB does not need to be consulted, the commit object does not need to be inflated, and the contents of the commit object do not need to be parsed. Part of: #5757
lhchavez 3fd57a75 2021-01-04T18:22:43 commit-graph: Introduce a parser for commit-graph files This change is the first in a series to add support for git's commit-graph. This should speed up commit graph traversals by avoiding object parsing and allowing some operations to terminate earlier. Part of: #5757
lhchavez 1a2f9609 2021-01-05T06:24:26 commit-graph: Introduce `git_commit_graph_needs_refresh()` This change introduces a function that allows the caller to know whether the `commit-graph` file has not been modified since it was parsed. Part of: #5757
Edward Thomson 923c0f7b 2021-01-07T17:34:17 clone: set refs/remotes/origin/HEAD when branch is specified When a branch is specified to check out in clone, update the remote tracking `HEAD` to point to it. This mimics git's behavior, when `git clone -b <name>` is used.
Edward Thomson c6cf7f0e 2021-01-07T17:00:57 Merge pull request #5769 from lhchavez/pwrite-pread Use `p_pwrite`/`p_pread` consistently throughout the codebase
lhchavez ff6f6754 2021-01-07T05:44:16 Use `p_pwrite`/`p_pread` consistently throughout the codebase This change stops using the seek+read/write combo to perform I/O with an offset, since this is faster by one system call (and also more atomic and therefore safer).
lhchavez d50d3db6 2021-01-07T05:43:30 midx: Fix a bug in `git_midx_needs_refresh()` The very last check in the freshness check for the midx was wrong >< This was also because this function was not tested.
Edward Thomson 3f4bc213 2021-01-07T14:05:02 repo: ignore empty init.defaultbranch The init.defaultbranch option may be set, but empty. In this case, we should ignore it instead of trying to set our default branch to `refs/heads/`.
Edward Thomson 32350e89 2021-01-07T14:01:30 remote: don't update invalid refs If a symbolic reference points to something invalid, then do not try to update it.
Edward Thomson c31032a3 2021-01-07T10:15:25 Merge pull request #5760 from libgit2/ethomson/tttoo_many_ttts blob: fix name of `GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD`
Edward Thomson 27e34f9b 2021-01-06T11:49:00 Merge pull request #5759 from JoshuaS3/master Add documentation for git_blob_filter_options.version
Edward Thomson 855f2998 2021-01-05T14:45:14 blob: fix name of `GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD` `GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD` is misspelled, it should be `GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD`, and it would be if it were not for the MacBook Pro keyboard and my inattentiveness.
Edward Thomson d9c15387 2021-01-05T14:29:58 blob: add git_blob_filter_options_init The `git_blob_filter_options_init` function should be included, to allow callers in FFI environments to let us initialize an options structure for them.
Edward Thomson f0d7922c 2021-01-05T12:12:19 Merge pull request #5583 from 0xdky/dhruva/build-with-nommap Build with NO_MMAP
lhchavez 754fa526 2021-01-04T06:10:10 Use an option instead of a flag for USE_BUNDLED_ZLIB Now `USE_BUNDLED_ZLIB` can be set to the string `Chromium` to enable the Chromium implementation of zlib.
Dhruva Krishnamurthy 4ce8e01a 2020-06-17T14:31:11 Support build with NO_MMAP to disable use of system mmap * Use pread/pwrite to avoid updating position in file descriptor * Emulate missing pread/pwrite on win32 using overlapped file IO
Dhruva Krishnamurthy a9f57a89 2020-11-23T10:14:00 Remove broken support for write in emulated mmap * Emulated mmap based write without pagefault handling is not possible since IO happens outside of call to mmap and data is written to mapped memory * Potential emulation using userfaultfd() might be possible
lhchavez 83265b3e 2020-12-18T06:50:22 zlib: Add support for building with Chromium's zlib implementation This change builds libgit2 using Chromium's zlib implementation by invoking cmake with `-DUSE_BUNDLED_ZLIB=ON -DUSE_CHROMIUM_ZLIB=ON`, which is ~10% faster than the bundled zlib for the core::zstream suite. This version of zlib has some optimizations: a) Decompression (Intel+ARM): inflate_fast, adler32, crc32, etc. b) Compression (Intel): fill_window, longest_match, hash function, etc. Due to the introduction of SIMD optimizations, and to get the maximum performance out of this fork of zlib, this requires an x86_64 processor with SSE4.2 and CLMUL (anything Westmere or later, ~2010). The Chromium zlib implementation also supports ARM with NEON, but it has not been enabled in this patch. Performance =========== TL;DR: Running just `./libgit2_clar -score::zstream` 100 times in a loop took 0:56.30 before and 0:50.67 after (~10% reduction!). The bundled and system zlib implementations on an Ubuntu Focal system perform relatively similar (the bundled one is marginally better due to the compiler being able to inline some functions), so only the bundled and Chromium zlibs were compared. For a more balanced comparison (to ensure that nothing regressed overall), `libgit2_clar` under `perf` was also run, and the zlib-related functions were compared. Bundled ------- ```shell cmake \ -DUSE_BUNDLED_ZLIB=ON \ -DUSE_CHROMIUM_ZLIB=OFF \ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ -DCMAKE_C_FLAGS="-fPIC -fno-omit-frame-pointer" \ -GNinja \ .. ninja perf record --call-graph=dwarf ./libgit2_clar perf report --children ``` ``` Samples: 87K of event 'cycles', Event count (approx.): 75923450603 Children Self Command Shared Objec Symbol + 4.14% 0.01% libgit2_clar libgit2_clar [.] git_zstream_get_output_chunk + 2.91% 0.00% libgit2_clar libgit2_clar [.] git_zstream_get_output + 0.69% 0.00% libgit2_clar libgit2_clar [.] git_zstream_get_output (inlined) 0.17% 0.00% libgit2_clar libgit2_clar [.] git_zstream_init 0.02% 0.00% libgit2_clar libgit2_clar [.] git_zstream_reset 0.00% 0.00% libgit2_clar libgit2_clar [.] git_zstream_eos 0.00% 0.00% libgit2_clar libgit2_clar [.] git_zstream_done 0.00% 0.00% libgit2_clar libgit2_clar [.] git_zstream_free (inlined) Samples: 87K of event 'cycles', Event count (approx.): 75923450603 Children Self Command Shared Objec Symbol + 3.12% 0.01% libgit2_clar libgit2_clar [.] deflate + 2.65% 1.48% libgit2_clar libgit2_clar [.] deflate_slow + 1.60% 0.55% libgit2_clar libgit2_clar [.] inflate + 0.53% 0.00% libgit2_clar libgit2_clar [.] write_deflate 0.49% 0.36% libgit2_clar libgit2_clar [.] inflate_fast 0.46% 0.02% libgit2_clar libgit2_clar [.] deflate_fast 0.19% 0.19% libgit2_clar libgit2_clar [.] inflate_table 0.16% 0.01% libgit2_clar libgit2_clar [.] inflateInit_ 0.15% 0.00% libgit2_clar libgit2_clar [.] inflateInit2_ (inlined) 0.10% 0.00% libgit2_clar libgit2_clar [.] deflateInit_ 0.10% 0.00% libgit2_clar libgit2_clar [.] deflateInit2_ 0.03% 0.00% libgit2_clar libgit2_clar [.] deflateReset (inlined) 0.02% 0.00% libgit2_clar libgit2_clar [.] deflateReset 0.02% 0.00% libgit2_clar libgit2_clar [.] inflateEnd 0.02% 0.00% libgit2_clar libgit2_clar [.] deflateEnd 0.01% 0.00% libgit2_clar libgit2_clar [.] deflateResetKeep 0.01% 0.01% libgit2_clar libgit2_clar [.] inflateReset2 0.01% 0.00% libgit2_clar libgit2_clar [.] deflateReset (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateStateCheck (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateReset (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateStateCheck (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] deflateStateCheck (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateResetKeep (inlined) ``` Chromium -------- ```shell cmake \ -DUSE_BUNDLED_ZLIB=ON \ -DUSE_CHROMIUM_ZLIB=ON \ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ -DCMAKE_C_FLAGS="-fPIC -fno-omit-frame-pointer" \ -GNinja \ .. ninja perf record --call-graph=dwarf ./libgit2_clar perf report --children ``` ``` Samples: 97K of event 'cycles', Event count (approx.): 80862210917 Children Self Command Shared Objec Symbol + 3.31% 0.00% libgit2_clar libgit2_clar [.] git_zstream_get_output_chunk + 2.27% 0.01% libgit2_clar libgit2_clar [.] git_zstream_get_output + 0.55% 0.00% libgit2_clar libgit2_clar [.] git_zstream_get_output (inlined) 0.18% 0.00% libgit2_clar libgit2_clar [.] git_zstream_init 0.02% 0.00% libgit2_clar libgit2_clar [.] git_zstream_reset 0.00% 0.00% libgit2_clar libgit2_clar [.] git_zstream_free (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] git_zstream_done 0.00% 0.00% libgit2_clar libgit2_clar [.] git_zstream_free Samples: 97K of event 'cycles', Event count (approx.): 80862210917 Children Self Command Shared Objec Symbol + 2.55% 0.01% libgit2_clar libgit2_clar [.] deflate + 2.25% 1.41% libgit2_clar libgit2_clar [.] deflate_slow + 1.10% 0.52% libgit2_clar libgit2_clar [.] inflate 0.36% 0.00% libgit2_clar libgit2_clar [.] write_deflate 0.30% 0.03% libgit2_clar libgit2_clar [.] deflate_fast 0.28% 0.15% libgit2_clar libgit2_clar [.] inflate_fast_chunk_ 0.19% 0.19% libgit2_clar libgit2_clar [.] inflate_table 0.17% 0.01% libgit2_clar libgit2_clar [.] inflateInit_ 0.16% 0.00% libgit2_clar libgit2_clar [.] inflateInit2_ (inlined) 0.15% 0.00% libgit2_clar libgit2_clar [.] deflateInit_ 0.15% 0.00% libgit2_clar libgit2_clar [.] deflateInit2_ 0.11% 0.01% libgit2_clar libgit2_clar [.] adler32_z 0.09% 0.09% libgit2_clar libgit2_clar [.] adler32_simd_ 0.05% 0.00% libgit2_clar libgit2_clar [.] deflateReset (inlined) 0.05% 0.00% libgit2_clar libgit2_clar [.] deflate_read_buf 0.03% 0.00% libgit2_clar libgit2_clar [.] inflateEnd 0.02% 0.00% libgit2_clar libgit2_clar [.] deflateReset 0.01% 0.00% libgit2_clar libgit2_clar [.] deflateEnd 0.01% 0.01% libgit2_clar libgit2_clar [.] inflateReset2 0.01% 0.00% libgit2_clar libgit2_clar [.] inflateReset (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] adler32 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateResetKeep (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] deflateResetKeep 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateStateCheck (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateStateCheck (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] inflateStateCheck (inlined) 0.00% 0.00% libgit2_clar libgit2_clar [.] deflateStateCheck (inlined) ```
Edward Thomson fe41e582 2020-12-23T12:32:58 Merge pull request #5741 from libgit2/ethomson/ipv6 Handle ipv6 addresses
Edward Thomson 27301cd0 2020-12-17T20:53:11 net: function to identify ipv6 addresses in URLs
Edward Thomson 953dee20 2020-12-17T20:51:37 net: is_default_port is a bool
Edward Thomson b7ffc63b 2020-12-17T18:38:01 winhttp: handle ipv6 addresses
Edward Thomson 2807de5c 2020-12-17T15:18:31 http: handle ipv6 addresses
Miguel Arroz 3433acd9 2020-12-21T21:27:58 Wrap newer hostkeys in #ifdefs This allows the library to be built using a pre-1.9.0 version of libssh2.
Miguel Arroz ed7b20e7 2020-12-21T17:26:34 Add support for additional hostkey types. Specifically: ECDSA_256, ECDSA_384, ECDSA_521 and ED25519.
Edward Thomson f4b473fa 2020-12-20T21:25:22 Merge pull request #5746 from libgit2/ethomson/configmapcache repository: use intptr_t's in the config map cache
Edward Thomson 1b708683 2020-12-20T20:42:40 config_cache: cleanup config map lookup
Edward Thomson f52f593e 2020-12-20T16:33:42 repository: use intptr_t's in the config map cache Since we're using atomic primitives to read and write into the config map cache, we need to read/write something pointer-sized. Use an `intptr_t` for the config map cache.
lhchavez 5ab0736b 2020-12-19T09:30:26 Add tests for `git__multiply_int64_overflow` As it turns out, the implementation of `git__multiply_int64_overflow` is full of edge cases and tricky arithmetic. That means that it should have unit tests. As a result, a bug in `git__strntol64` was found (and fixed!) in clang+32-bit.
lhchavez e9b98cd5 2020-12-18T19:43:13 Third attempt to fix the 32-bit version of `git__multiply_int64_overflow` This change should now fix the issue for realsies. `./libgit2_clar -score::strtol` passes on a 32-bit Docker.
lhchavez 7f8ae019 2020-12-18T07:03:21 Avoid using `__builtin_mul_overflow` with the clang+32-bit combo This causes clang to produce an undefined reference to `__mulodi4`. This could be fixed by statically linking some compiler-rt libraries to provide this symbol, but let's first stop the bleeding since doing the correct long-term fix requires some non-trivial CMake knowledge which I lack.
Edward Thomson 1865806e 2020-12-16T00:16:10 Merge pull request #5740 from libgit2/ethomson/zlib pack: continue zlib while we can make progress
Edward Thomson 93f61c5a 2020-12-15T23:03:03 pack: continue zlib while we can make progress Continue the zlib stream as long as we can make progress; stop when we stop getting output _or_ when zlib stops taking input from us.
Edward Thomson d185ab24 2020-12-13T15:18:12 Merge pull request #5727 from lhchavez/make-git-diff-fast Cache the parsed submodule config when diffing
Edward Thomson 851e778e 2020-12-13T13:46:16 Merge pull request #5735 from lhchavez/faster-strntol64 Make git__strntol64() ~70%* faster
Edward Thomson 86a1cdd3 2020-12-13T13:44:56 Merge pull request #5384 from ianhattendorf/fix/winhttp-client-cert winhttp: support optional client cert
lhchavez e99e833f 2020-12-12T16:51:15 Make git__strntol64() ~70%* faster 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 ```
lhchavez 1ab2f577 2020-12-11T05:13:16 Fix an oops
Jason Haslam 58d757b1 2016-11-14T16:52:33 patch: add owner accessor
lhchavez 6cd0c853 2020-12-11T05:08:45 Small refactor to make thing tidier Also repurposed an unused function and deleted another one.
lhchavez 41da4e16 2020-12-10T19:52:01 Cache the parsed submodule config when diffing 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
Edward Thomson 08f28ff5 2020-07-10T08:57:05 alloc: set up an allocator that fails before library init 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.)
Edward Thomson 6c51014d 2020-07-11T14:24:17 libgit2: provide init_count of the library 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.
Tyler Ang-Wanek 20ce17f0 2020-08-06T16:24:27 Replace global storage TLS with new interface
Edward Thomson fd2d4759 2020-12-05T22:22:38 threads: git_tls_data to git_tlsdata Use a no-allocation approach to the TLS data abstraction.
Edward Thomson 42d5f110 2020-12-08T14:33:31 win32: provide macros for calling conventions 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).
Tyler Ang-Wanek 971b7187 2020-08-06T16:24:18 Implement generic TLS interface 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.
Edward Thomson 404dd024 2020-12-05T15:57:48 threads: rename thread files to thread.[ch]
Edward Thomson ab772974 2020-12-05T15:49:30 threads: give atomic functions the git_atomic prefix
Edward Thomson 37763d38 2020-12-05T15:26:59 threads: rename git_atomic to git_atomic32 Clarify the `git_atomic` type and functions now that we have a 64 bit version as well (`git_atomic64`).
Edward Thomson 9800728a 2020-12-05T16:08:34 util: move git_online_cpus into util 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
Edward Thomson fe07ef8a 2020-12-05T21:38:29 packbuilder: use git__noop on non-threaded systems Our git_packbuilder__cache_lock function returns a value; use git__noop.
Edward Thomson 8413c0f9 2020-12-05T21:32:48 util: move git__noop into the util header The git__noop function is more largely useful; move it into the util header. (And reduce the number of underscores.)
lhchavez 322c15ee 2020-08-01T18:24:41 Make the pack and mwindow implementations data-race-free 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
lhchavez 4ae41f9c 2020-08-02T16:26:25 Make the odb race-free This change adds all the necessary locking to the odb to avoid races in the backends. Part of: #5592
Edward Thomson ef6de8d5 2020-11-27T14:46:38 Merge pull request #5704 from lhchavez/ssh-raw-certificate Also add the raw hostkey to `git_cert_hostkey`