src


Log

Author Commit Date CI Message
Edward Thomson 00974bca 2020-04-05T14:52:48 date: use GIT_ASSERT
Edward Thomson e7604da8 2020-04-05T14:51:56 config: use GIT_ASSERT
Edward Thomson d4384977 2020-04-05T14:38:20 clone: use GIT_ASSERT
Edward Thomson 5d8b75fa 2020-04-05T14:37:22 cherrypick: use GIT_ASSERT
Edward Thomson 3b2153fe 2020-04-05T14:42:44 commit: use GIT_ASSERT
Edward Thomson 266f26ed 2020-04-05T14:35:23 checkout: use GIT_ASSERT
Edward Thomson cb4bfbc9 2020-04-05T11:07:54 buffer: git_buf_sanitize should return a value `git_buf_sanitize` is called with user-input, and wants to sanity-check that input. Allow it to return a value if the input was malformed in a way that we cannot cope.
Edward Thomson f60ebfcb 2020-04-04T23:31:05 annotated_commit: use GIT_ASSERT
Edward Thomson a6dd5865 2020-04-05T10:23:20 buffer: use GIT_ASSERT
Edward Thomson 7d24070d 2020-04-05T10:14:28 branch: use GIT_ASSERT
Edward Thomson abb7a7e4 2020-04-05T10:11:34 blob: use GIT_ASSERT
Edward Thomson efab78cd 2020-04-05T10:09:11 blame: use GIT_ASSERT
Edward Thomson b44b262b 2020-04-05T10:07:09 attr_file: use GIT_ASSERT
Edward Thomson e0f3c33d 2020-04-05T11:22:19 buffer: git_buf_copy_cstr should return a value `git_buf_copy_cstr` is called with user-input, and wants to sanity-check that input. Allow it to return a value if the input was malformed in a way that we cannot cope.
Edward Thomson 7b2f94bf 2020-04-05T10:04:52 attr: use GIT_ASSERT
Edward Thomson c6e84bce 2020-04-05T09:49:28 apply: use GIT_ASSERT
Edward Thomson d9d86e41 2020-11-21T22:13:51 Merge pull request #5580 from libgit2/ethomson/win32_leakcheck msvc crtdbg -> win32 leakcheck
Edward Thomson 045748bb 2020-11-21T22:06:57 Merge pull request #5692 from rbmclean/master Add missing worktree_dir check and test case
Edward Thomson c8fe4da3 2020-11-21T22:06:03 Apply suggestions from code review
Edward Thomson 8aed4629 2020-07-12T18:43:22 cmake: rename MSVC_CRTDBG to WIN32_LEAKCHECK
Edward Thomson 51825c4f 2020-07-12T18:18:12 alloc: rename the win32 leakcheck allocator The win32 leakchecking system is now named win32_leakcheck. Update the allocator to match.
Edward Thomson 31654a34 2020-07-12T18:07:10 win32: consolidate leak checking initialization Move leak check initialization into git_win32_leakcheck_global_init, and call it on library initialization.
Edward Thomson cb4b3bdf 2020-07-12T17:49:42 win32: "crtdbg" is now "leakcheck" msvc crtdbg is a mouthfull that is not particularly indicative of what it does. Let's rename it to "win32 leakcheck".
Edward Thomson a6d151bf 2020-11-21T21:31:41 Merge pull request #5690 from lhchavez/fix-filelimit-compile-error Fix the `-DTHREADSAFE=OFF` build
Reginald McLean 6405ce29 2020-11-06T11:36:25 worktree: Added worktree_dir check Fixes #5280
lhchavez aa532e29 2020-10-31T07:51:03 Fix the `-DTHREADSAFE=OFF` build This change avoids using the `(void)0` construct for some of the mutex `#define`s, since that makes the "return type" of those "functions" to be `void` instead of `int`.
Sven Strickroth 0caa4655 2020-09-09T10:48:00 Add git_tag_name_is_valid Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth fe11160c 2020-09-08T21:05:18 Add git_branch_name_is_valid Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson c7143d7c 2020-10-11T13:56:16 remote: deprecate git_remote_is_valid_name
Edward Thomson 55a7117d 2020-10-11T13:55:44 remote: use git_remote_name_is_valid
Edward Thomson 023ebb9a 2020-10-11T13:48:07 refs: introduce git_remote_name_is_valid Provide a function that can check remote name validity but can also signal when an error occurs. Use the name "name_is_valid", which is more suggestive of checking a given name, rather than "is_valid_name", which suggests that the function checks the validity of the current remote's name.
Edward Thomson 68e35588 2020-10-11T13:35:35 refspec: return GIT_EINVALIDSPEC for invalid specs Disambiguate invalid specifications in `git_refspec__parse` so that callers can determine the difference between invalid specifications and actual errors. No call sites wil propagagte this new error message to an end-user, so there is no user-facing API change.
Edward Thomson 63460fe4 2020-10-11T13:21:13 refs: deprecate git_reference_is_valid_name
Edward Thomson b52bb4d4 2020-10-11T13:20:52 refs: use git_reference_name_is_valid
Edward Thomson 29715d40 2020-10-11T12:50:52 refs: introduce git_reference_name_is_valid Provide a function that can check reference name validity but can also signal when an error occurs. Use the name "name_is_valid", which is more suggestive of checking a given name, rather than "is_valid_name", which suggests that the function checks the validity of the current reference's name.
Edward Thomson d70979cf 2020-10-11T12:26:34 refs: error checking in internal name validation Move `git_reference__is_valid_name` to `git_reference__name_is_valid`, which returns errors and sets an out boolean parameter.
Edward Thomson 246bc3cc 2020-10-14T15:05:11 threadstate: rename tlsdata when building w/o threads
Edward Thomson 20450cbe 2020-10-14T13:44:59 Merge pull request #5546 from libgit2/ethomson/init Refactor "global" state
Edward Thomson e9858645 2020-10-14T12:40:20 Merge pull request #5661 from lhchavez/windows-leak-detection-deflake Make the Windows leak detection more robust
lhchavez fa3daa82 2020-10-13T08:02:59 Define `git___load` when building with `-DTHREADSAFE=OFF` This should allow folks that build in non-thread-safe environments to still be able to build the library. Fixes: #5663
lhchavez 4a0dceeb 2020-10-11T17:53:10 Make the Windows leak detection more robust This change: * Increases MY_ROW_LIMIT to 2M, since it has been failing in #5595's tests since it's _super_ close to the limit. * Calls `git_repository_free()` on a `git_repository` that was being leaked only in Windows. * Marks the global `git_repository` on `tests/repo/init.c` as `NULL` after being freed to make any accidental access more noisy. * Uses `cl_assert_equal_i()` in `test_trace_windows_stacktrace__leaks` to make the test failures more actionable. * Renames the globals in `tests/repo/init.c` so that they don't start with an underscore.
Edward Thomson 634c285a 2020-07-11T12:35:58 Move libgit2 settings into libgit2.c
Edward Thomson 1ec4702a 2020-07-11T12:25:51 Rename global.c to libgit2.c Now that we've identified that our global settings really aren't global at all, and refactored the library to match that, change global.c to libgit2.c, which is especially nice since the prefix of the functions matches the filename.
Edward Thomson e316b0d3 2020-05-15T11:47:09 runtime: move init/shutdown into the "runtime" Provide a mechanism for system components to register for initialization and shutdown of the libgit2 runtime.
Edward Thomson 8970acb7 2020-05-15T10:29:41 thread: don't use the global tlsdata for thread exit We want to store a pointer to emulate `pthread_exit` on Windows. Do this within the threading infrastructure so that it could potentially be re-used outside of the context of libgit2 itself.
Edward Thomson 4853d94c 2020-05-14T10:36:35 global: separate global state from thread-local state Our "global initialization" has accumulated some debris over the years. It was previously responsible for both running the various global initializers (that set up various subsystems) _and_ setting up the "global state", which is actually the thread-local state for things like error reporting. Separate the thread local state out into "threadstate". Use the normal subsystem initialization functions that we already have to set it up. This makes both the global initialization system and the threadstate system simpler to reason about.
Edward Thomson bc3919ab 2020-07-11T12:14:26 global init: check error message buffer allocation Ensure that we can allocate the error message buffer. In keeping with our typical policiess, we allow (small) memory leaks in the case where we're out of memory.
Edward Thomson 8aa69f88 2020-05-13T10:48:13 mwindow: localize mutex Move the mwindow mutex into the mwindow code itself, initializing it in the mwindow global initialization function instead of in the global initializer.
Edward Thomson 6554b40e 2020-05-13T10:39:33 settings: localize global data Move the settings global data teardown into its own separate function, instead of intermingled with the global state.
Edward Thomson 521aa8c1 2020-05-12T13:21:26 win32: teach the allocator to deal with crtdbg Move the MSVC C runtime debugging bits into the allocator's global init function.
Edward Thomson fe12423a 2020-05-12T13:08:22 init: move thread init to git_global_threads_init Instead of treating win32 thread initialization specially in the win32 git_libgit2_init function, add a git_global_threads_init function.
Edward Thomson 94e34582 2020-10-11T11:32:04 Merge pull request #5651 from libgit2/ethomson/clone_branch clone: update origin's HEAD
lhchavez 03c0938f 2020-08-25T06:13:38 Avoid using atomics in pool.c Instead, globally initialize the system page size.
lhchavez cc1d7f5c 2020-08-01T17:47:20 Improve the support of atomics This change: * Starts using GCC's and clang's `__atomic_*` intrinsics instead of the `__sync_*` ones, since the former supercede the latter (and can be safely replaced by their equivalent `__atomic_*` version with the sequentially consistent model). * Makes `git_atomic64`'s value `volatile`. Otherwise, this will make ThreadSanitizer complain. * Adds ways to load the values from atomics. As it turns out, unsynchronized read are okay only in some architectures, but if we want to be correct (and make ThreadSanitizer happy), those loads should also be performed with the atomic builtins. * Fixes two ThreadSanitizer warnings, as a proof-of-concept that this works: - Avoid directly accessing `git_refcount`'s `owner` directly, and instead makes all callers go through the `GIT_REFCOUNT_*()` macros, which also use the atomic utilities. - Makes `pool_system_page_size()` race-free. Part of: #5592
Eric Huss 5b7e7131 2020-10-07T15:54:08 Fix error return for invalid extensions.
Dan Tull cce966c3 2020-10-06T17:51:14 Change bare free to allocator free. The info pointer was allocated with git__malloc, so needs to be free'd with git__free. This bug can lurk pretty easily since if there's no custom allocator this is fine.
Edward Thomson c1f1bcad 2020-10-05T11:04:38 clone: update origin's HEAD Update `refs/remotes/origin/HEAD` as a symbolic link to the remote's default branch.
lhchavez 005e7715 2020-02-23T22:28:52 multipack: Introduce a parser for multi-pack-index files This change is the first in a series to add support for git's multi-pack-index. This should speed up large repositories significantly. Part of: #5399
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
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 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
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 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>
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>
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).
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.
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 da3288de 2020-08-24T11:20:50 Merge pull request #5600 from andrewhickman/fix-double-free Fix `git_mwindow_scan_recently_used` spuriously returning true
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 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 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.