summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* | | 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.
| * | repository: remove function to iterate over HEADsPatrick Steinhardt2020-07-121-43/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | repository: introduce new function to iterate over all worktreesPatrick Steinhardt2020-07-121-0/+30
| | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5396 from lhchavez/mwindow-file-limitEdward Thomson2020-07-121-0/+136
|\ \ \ | | | | | | | | mwindow: set limit on number of open files
| * | | Minor nits and style formattinglhchavez2020-07-121-17/+15
| | | |
| * | | Create the repository within the testlhchavez2020-06-272057-37/+89
| | | | | | | | | | | | | | | | | | | | This change moves the humongous static repository with 1025 commits into the test file, now with a more modest 16 commits.
| * | | Review feedbacklhchavez2020-06-261-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * | | mwindow: set limit on number of open fileslhchavez2020-06-212057-0/+50
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | tests: reflog: remove unused signaturePatrick Steinhardt2020-07-121-9/+0
| | | | | | | | | | | | | | | There's two tests that create a commit signature, but never make any use of it. Let's remove these to avoid any confusion.
* | | Make the tests pass cleanly with MemorySanitizerlhchavez2020-06-302-2/+2
|/ / | | | | | | | | | | | | | | | | 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`.
* | Merge pull request #5552 from libgit2/pks/small-fixesEdward Thomson2020-06-131-8/+3
|\ \ | | | | | | Random code cleanups and fixes
| * | tests: refs: modernize coding style of testcasePatrick Steinhardt2020-06-081-8/+3
| | | | | | | | | | | | | | | The coding style of the testcase refs::create::propagate_eexists is not really up-to-date. Convert it to use a more modern coding style.
* | | tree-wide: do not compile deprecated functions with hard deprecationPatrick Steinhardt2020-06-091-5/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h" header to be empty. As a result, no function declarations are made available to callers, but the implementations are still available to link against. This has the problem that function declarations also aren't visible to the implementations, meaning that the symbol's visibility will not be set up correctly. As a result, the resulting library may not expose those deprecated symbols at all on some platforms and thus cause linking errors. Fix the issue by conditionally compiling deprecated functions, only. While it becomes impossible to link against such a library in case one uses deprecated functions, distributors of libgit2 aren't expected to pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real" hard deprecation still makes sense in the context of CI to test we don't use deprecated symbols ourselves and in case a dependant uses libgit2 in a vendored way and knows it won't ever use any of the deprecated symbols anyway.
* | Merge pull request #5541 from libgit2/ethomson/clar_tapEdward Thomson2020-06-0525-170/+336
|\ \ | | | | | | clar: add tap output option
| * | clar: include the function nameethomson/clar_tapEdward Thomson2020-06-0525-161/+182
| | |
| * | clar: add tap outputEdward Thomson2020-06-043-3/+99
| | |
| * | clar: add an output abstraction layerEdward Thomson2020-06-033-12/+31
| | | | | | | | | | | | | | | Add an output abstraction layer, with a single output format, "clap", the clar protocol, which is the current output format for clar.
| * | clar: parse arguments before printing the headerEdward Thomson2020-06-031-3/+3
| | | | | | | | | | | | | | | We want to parse arguments before we start printing any output; the arguments themselves may impact the way we display that output.
| * | clar: print indirectionEdward Thomson2020-06-031-6/+36
| | |
* | | diff::parse: don't include `diff.h`ethomson/diff_parseEdward Thomson2020-06-051-1/+0
| | | | | | | | | | | | | | | We don't call any internal functions in the test; we don't need to include `../src/diff.h`.
* | | Merge pull request #5537 from libgit2/ethomson/clar_exactmatchPatrick Steinhardt2020-06-031-0/+9
|\ \ \ | | | | | | | | tests: offer exact name matching with a `$` suffix
| * | | offer exact name matching with a `$` suffixethomson/clar_exactmatchEdward Thomson2020-06-021-0/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using `-s` to specify a particular test, it will do a prefix match. Thus, `-sapply::both::rename_a_to_b_to_c` will match both a test named `test_apply_both__rename_a_to_b_to_c` and a test that begins with that name, like `test_apply_both__rename_a_to_b_to_c_exact`. Permit a trailing `$` to `-s` syntax. This allows a user to specify `-sapply::both::rename_a_to_b_to_c$` to match _only_ the `test_apply_both__rename_a_to_b_to_c` function. We already filter to ensure that the given prefix matches the current test name. Also ensure that the length of the test name matches the length of the filter, sans trailing `$`.
* | | Merge pull request #5536 from libgit2/ethomson/httpPatrick Steinhardt2020-06-031-0/+8
|\ \ \ | | | | | | | | httpclient: support googlesource
| * | | online::clone: test a googlesource URLEdward Thomson2020-06-011-0/+8
| | | | | | | | | | | | | | | | | | | | Google Git (googlesource.com) behaves differently than git proper. Test that we can communicate with it.
* | | | Merge pull request #5532 from joshtriplett/pack-default-pathEdward Thomson2020-06-021-0/+9
|\ \ \ \ | |_|/ / |/| | | git_packbuilder_write: Allow setting path to NULL to use the default path
| * | | git_packbuilder_write: Allow setting path to NULL to use the default pathJosh Triplett2020-05-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | If given a NULL path, write to the object path of the repository. Add tests for the new behavior.
* | | | clar: remove unused shell_out functionethomson/clar_internalEdward Thomson2020-06-021-26/+0
| | | |
* | | | clar: remove files internally instead of /bin/rmEdward Thomson2020-06-021-10/+37
| | | | | | | | | | | | | | | | | | | | | | | | Similar to how clar has used `/bin/cp` to copy files, it's used `/bin/rm` to remove them. This has similar deficiencies; meaning that leaks is noisy and it's slow. Move it to an internal function.
* | | | clar: copy files with sendfile on linuxEdward Thomson2020-06-021-6/+27
| | | |
* | | | clar: copy files internally instead of /bin/cpEdward Thomson2020-06-021-18/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clar has historically shelled out to `/bin/cp` to copy test fixtures into a sandbox. This has two deficiencies: 1. It's slower than simply opening the source and destination and copying them in a read/write loop. On my Mac, the `/bin/cp` based approach takes ~2:40 for a full test pass. Using a read/write loop to copy the files ourselves takes ~1:50. 2. It's noisy. Since the leak detector follows fork/exec, we'll end up running the leak detector on `/bin/cp`. This would be fine, except that the leak detector spams the console on startup and shutdown, so it adds a _lot_ of additional information to the test runs that is useless. By not forking and using this internal system, we see much less output.
* | | | strarray: we should `dispose` instead of `free`Edward Thomson2020-06-0115-64/+64
| |/ / |/| | | | | | | | | | | | | | We _dispose_ the contents of objects; we _free_ objects (and their contents). Update `git_strarray_free` to be `git_strarray_dispose`. `git_strarray_free` remains as a deprecated proxy function.
* | | Merge pull request #5529 from libgit2/ethomson/difftestPatrick Steinhardt2020-06-011-3/+3
|\ \ \ | | | | | | | | diff::workdir: actually test the buffers
| * | | diff::workdir: actually test the buffersethomson/difftestEdward Thomson2020-05-231-3/+3
| |/ / | | | | | | | | | | | | | | | The static test data is erroneously initialized with a length of 0 for three of the strings. This means the tests are not actually examining those strings. Provide the length.
* | | Merge pull request #5527 from libgit2/ethomson/config_unreadablePatrick Steinhardt2020-06-011-0/+17
|\ \ \ | | | | | | | | Handle unreadable configuration files
| * | | config: test that unreadable files are treated as notfoundEdward Thomson2020-06-011-0/+17
| |/ /
* | | tests: index::version: write v4 index: re-open repo to read written v4 indexPatrick Wang2020-05-271-1/+4
|/ / | | | | | | | | | | | | | | | | The `git_index_free()` merely decrement the reference counter from 2 to 1, and does not "free" the index. Thus, the following `git_repository_index()` merely increase the counter to 2, instead of read index from disk. The written index is not read and parsed, which makes this test case effectively becomes a no-op.
* | checkout::index: free the indexEdward Thomson2020-05-231-0/+2
| |
* | tests: checkout: fix stylistic issues and static variablePatrick Steinhardt2020-05-161-19/+13
| | | | | | | | | | | | | | | | The test case checkout::index::can_disable_pathspec_match has some shortcomings when it comes to coding style, which didn't fit our own coding style. Furthermore, it had an unnecessary static local variable. The test has been refactored to address these issues.
* | tests: merge: fix printf formatter on 32 bit archesPatrick Steinhardt2020-05-121-1/+1
| | | | | | | | | | | | | | | | | | We currently use `PRIuMAX` to print an integer of type `size_t` in merge::trees::rename::cache_recomputation. While this works just fine on 64 bit arches, it doesn't on 32 bit ones. As a result, our nightly builds on x86 and arm32 fail. Fix the issue by using `PRIuZ` instead.
* | assert: allow non-int returning functions to assertethomson/assert_macrosEdward Thomson2020-05-111-0/+53
| | | | | | | | | | | | | | | | | | | | Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that functions that do not return int (or more precisely, where `-1` would not be an error code) can assert. This allows functions that return, eg, NULL on an error code to do that by passing the return value (in this example, `NULL`) as a second parameter to the GIT_ASSERT_WITH_RETVAL functions.
* | assert: optionally fall-back to assert(3)Edward Thomson2020-05-111-0/+2
| | | | | | | | | | | | | | | | | | Fall back to the system assert(3) in debug builds, which may aide in debugging. "Safe" assertions can be enabled in debug builds by setting GIT_ASSERT_HARD=0. Similarly, hard assertions can be enabled in release builds by setting GIT_ASSERT_HARD to nonzero.
* | Introduce GIT_ASSERT macrosEdward Thomson2020-05-111-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | Provide macros to replace usages of `assert`. A true `assert` is punishing as a library. Instead we should do our best to not crash. GIT_ASSERT_ARG(x) will now assert that the given argument complies to some format and sets an error message and returns `-1` if it does not. GIT_ASSERT(x) is for internal usage, and available as an internal consistency check. It will set an error message and return `-1` in the event of failure.
* | checkout: Fix removing untracked files by path in subdirectoriesSegev Finer2020-05-111-0/+26
| | | | | | | | | | | | | | | | The checkout code didn't iterate into a subdir if it didn't match the pathspec, but since the pathspec might match files in the subdir we should recurse into it (In contrast to gitignore handling). Fixes #5089
* | tests::checkout: only examine test10 and test11.txtEdward Thomson2020-05-101-2/+2
| | | | | | | | | | | | | | The checkout::index::can_disable_pathspec_match test attempts to set a path filter of `test11.txt` and `test12.txt`, but then validates that `test10.txt` and `test11.txt` were left unmodified. Update the test's path filter to match the expectation.
* | Create test case demonstrating checkout bug w/ pathspec match disabledFelix Lapalme2020-05-101-0/+59
| |
* | blame: add option to ignore whitespace changesCarl Schwan2020-04-1426-1/+23
|/
* Merge pull request #5480 from libgit2/ethomson/coverityPatrick Steinhardt2020-04-041-2/+2
|\ | | | | repo::open: ensure we can open the repository