summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Add tests for `git__multiply_int64_overflow`lhchavez2020-12-192-0/+255
| | | | | | | | | 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.
* 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.
* threads: git_tls_data to git_tlsdataEdward Thomson2020-12-081-0/+65
| | | | Use a no-allocation approach to the TLS data abstraction.
* threads: rename thread files to thread.[ch]Edward Thomson2020-12-061-1/+1
|
* threads: rename git_atomic to git_atomic32Edward Thomson2020-12-061-9/+9
| | | | | Clarify the `git_atomic` type and functions now that we have a 64 bit version as well (`git_atomic64`).
* tests: ifdef out unused function in no-thread buildsEdward Thomson2020-12-051-0/+2
|
* Make the pack and mwindow implementations data-race-freelhchavez2020-11-282-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* midx: Support multi-pack-index files in odb_pack.clhchavez2020-11-271-0/+16
| | | | | | | | | | | | 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
* path: remove unused git_path_topdirEdward Thomson2020-11-271-27/+1
|
* Merge pull request #5580 from libgit2/ethomson/win32_leakcheckEdward Thomson2020-11-212-45/+44
|\ | | | | msvc crtdbg -> win32 leakcheck
| * cmake: rename MSVC_CRTDBG to WIN32_LEAKCHECKEdward Thomson2020-11-212-7/+7
| |
| * win32: "crtdbg" is now "leakcheck"Edward Thomson2020-11-211-38/+37
| | | | | | | | | | msvc crtdbg is a mouthfull that is not particularly indicative of what it does. Let's rename it to "win32 leakcheck".
* | Merge pull request #5692 from rbmclean/masterEdward Thomson2020-11-211-0/+12
|\ \ | |/ |/| Add missing worktree_dir check and test case
| * Apply suggestions from code reviewEdward Thomson2020-11-212-1/+1
| |
| * worktree: change test to invalidate worktree via filesystemReginald McLean2020-11-072-4/+2
| |
| * worktree: Demonstrate missing worktree checkReginald McLean2020-11-061-0/+14
| | | | | | | | worktree_dir isn't validated when it should be
* | Add git_tag_name_is_validSven Strickroth2020-10-251-0/+17
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Add git_branch_name_is_validSven Strickroth2020-10-251-0/+17
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | remote: use git_remote_name_is_validEdward Thomson2020-10-251-8/+15
| |
* | refspec: return GIT_EINVALIDSPEC for invalid specsEdward Thomson2020-10-251-1/+1
| | | | | | | | | | | | | | 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.
* | refs: use git_reference_name_is_validEdward Thomson2020-10-252-23/+32
|/
* Merge pull request #5546 from libgit2/ethomson/initEdward Thomson2020-10-143-3/+8
|\ | | | | Refactor "global" state
| * runtime: move init/shutdown into the "runtime"Edward Thomson2020-10-111-1/+0
| | | | | | | | | | Provide a mechanism for system components to register for initialization and shutdown of the libgit2 runtime.
| * thread: restore the git_thread_exit testsEdward Thomson2020-10-111-1/+7
| | | | | | | | We were never properly testing git_thread_exit. Do so.
| * settings: localize global dataEdward Thomson2020-10-111-1/+1
| | | | | | | | | | Move the settings global data teardown into its own separate function, instead of intermingled with the global state.
* | Make the Windows leak detection more robustlhchavez2020-10-112-93/+101
|/ | | | | | | | | | | | | | | 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.
* clone: test that the origin HEAD is createdEdward Thomson2020-10-061-1/+6
| | | | | Ensure that we created `refs/remotes/origin/HEAD` when cloning, a symbolic link pointing to `refs/remotes/origin/<default>`
* multipack: Introduce a parser for multi-pack-index fileslhchavez2020-10-052-0/+29
| | | | | | | 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
* Merge pull request #5494 from kevinjswinton/masterEdward Thomson2020-10-042-4/+2
|\ | | | | Fix binary diff showing /dev/null
| * Fix binary diff showing /dev/nullKevin Swinton2020-04-182-4/+2
| | | | | | | | | | | | Fixes issue where a changed binary file's content in the working tree isn't displayed correctly, instead showing an oid of zero, and with its path being reported incorrectly as "/dev/null".
* | Merge pull request #5581 from libgit2/ethomson/mainbranchEdward Thomson2020-10-042-0/+33
|\ \ | | | | | | Respect `init.defaultBranch` setting
| * | clone: respect init.defaultBranch when emptyEdward Thomson2020-08-031-0/+17
| | | | | | | | | | | | | | | | | | 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.
| * | repo: honor the init.defaultBranch settingEdward Thomson2020-08-031-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5620 from dlax/parse-patch-add-delete-no-indexEdward Thomson2020-10-041-0/+23
|\ \ \ | | | | | | | | patch_parse: handle absence of "index" header for new/deleted cases
| * | | patch_parse: handle absence of "index" header for new/deleted casesDenis Laxalde2020-08-291-0/+23
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5626 from csware/parse_boolEdward Thomson2020-10-041-0/+76
|\ \ \ | | | | | | | | boolean config parsing fails in some cases with mapped values
| * | | Improve formattingSven Strickroth2020-09-091-1/+10
| | | | | | | | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
| * | | Add boolean tests for "on" and "off"Sven Strickroth2020-09-091-1/+7
| | | | | | | | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
| * | | Support empty values for git_config_get_mapped and git_config_lookup_map_valueSven Strickroth2020-09-091-1/+3
| | | | | | | | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
| * | | Fix parsing boolean config values when using git_config_get_mapped and ↵Sven Strickroth2020-09-091-0/+59
| |/ / | | | | | | | | | | | | | | | git_config_lookup_map_value Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | Merge pull request #5629 from csware/config-multiline-parseEdward Thomson2020-10-042-0/+15
|\ \ \ | | | | | | | | Fix config file parsing with multi line values containing quoted parts
| * | | Fix config file parsing with multi line values containing quoted partsSven Strickroth2020-09-182-0/+15
| |/ / | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | Merge pull request #5619 from ddevault/diffstat-segfaultEdward Thomson2020-09-171-0/+35
|\ \ \ | | | | | | | | diff stats: fix segfaults with new files
| * | | diff stats: fix segfaults with new filesDrew DeVault2020-09-161-0/+35
| |/ /
* | | Removed FreeBSD-related macros.Philipp2020-09-141-7/+1
| | |
* | | Fixed includes for FreeBSD.Philipp2020-09-091-1/+7
|/ /
* | Merge pull request #5563 from pks-t/pks/worktree-headsEdward Thomson2020-08-033-37/+30
|\ \ | | | | | | Access HEAD via the refdb backends
| * | tests: verify renaming branch really updates worktree HEADPatrick Steinhardt2020-07-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | repository: retrieve worktree HEAD via refdbPatrick Steinhardt2020-07-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.