summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* status::renames: write NFD instead of NFC filenameethomson/apfs_precompose_fixesEdward Thomson2018-01-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Update the status::renames test to create an NFD format filename in the core.precomposedunicode tests. Previously, we would create an NFC format filename. This was to take advantage of HFS+ filesystems, which always use canonically decomposed formats, and would actually write the filename to disk as an NFD filename. So previously, we could create an NFC filename, but read it normally as an NFD filename. But APFS formats do not force canonically decomposed formats for filenames, so creating an NFC filename does not get converted to NFD. Instead, the filename will be written in NFC format. Our test, therefore, does not work - when we write an NFC filename, it will _remain_ NFC. Update the test to write NFD always. This will ensure that the file will actually be canonically decomposed on all platforms: HFS+, which forces NFD, and APFS, which does not. Thus, our test will continue to ensure that an NFD filename is canonically precomposed on all filesystems.
* tests: online::clone: fix memory leak due to not freeing URLPatrick Steinhardt2018-01-181-0/+2
|
* Merge pull request #4451 from libgit2/charliesome/trailer-infoBrian Lopez2018-01-171-0/+165
|\ | | | | Implement message trailer parsing API
| * just use git_message_trailer in testsBrian Lopez2018-01-161-15/+10
| |
| * try and fix windows buildBrian Lopez2018-01-161-1/+2
| |
| * Change trailer API to return a simple arrayBrian Lopez2018-01-161-20/+10
| |
| * Merge remote-tracking branch 'origin/master' into charliesome/trailer-infoBrian Lopez2018-01-108-29/+33
| |\
| * | switch back to braced array initializersBrian Lopez2018-01-051-61/+40
| | |
| * | Don't use newer C syntax for declaration in testsBrian Lopez2018-01-031-57/+78
| | |
| * | Merge remote-tracking branch 'origin/master' into charliesome/trailer-infoBrian Lopez2018-01-0213-26/+738
| |\ \
| * | | tests: add message trailer parsing test casesCharlie Somerville2017-12-191-0/+179
| | | |
* | | | tests: refs::iterator: fix memory leak due to ref names not being free'dPatrick Steinhardt2018-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The test refs::iterator::foreach_name iterates through every reference and copies its name into a local vector. While the test makes sure to free the vector afterwards, the copied reference names are not being free'd. Fix that.
* | | | tests: network::fetchlocal: let cleanup function handle sandbox cleanupPatrick Steinhardt2018-01-121-8/+0
| |_|/ |/| | | | | | | | | | | | | | | | | | | | Two tests in network::fetchlocal explicitly set a cleanup function to free and remove the created sandbox repositories. This is not necessary, though, as the cleanup function executed after each test already takes care of cleaning up after them. Remove the code to avoid needless code duplication.
* | | Merge pull request #4257 from pks-t/pks/stale-testEdward Thomson2018-01-038-29/+33
|\ \ \ | |_|/ |/| | Execute stale tests
| * | tests: create new test target for all SSH-based testsPatrick Steinhardt2018-01-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Some tests shall be run against our own SSH server we spin up in Travis. As those need to be run separate from our previous tests which run against git-daemon, we have to do this in a separate step. Instead of bundling all that knowledge in the CI script, move it into the test build instructions by creating a new test target.
| * | tests: online::clone: inline creds-test with nonexistent URLPatrick Steinhardt2018-01-032-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | Right now, we test our credential callback code twice, once via SSH on localhost and once via a non-existent GitHub repository. While the first URL makes sense to be configurable, it does not make sense to hard-code the non-existing repository, which requires us to call tests multiple times. Instead, we can just inline the URL into another set of tests.
| * | tests: online::clone: construct credential-URL from environmentPatrick Steinhardt2018-01-032-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We support two types of passing credentials to the proxy, either via the URL or explicitly by specifying user and password. We test these types by modifying the proxy URL and executing the tests twice, which is in fact unnecessary and requires us to maintain the list of environment variables and test executions across multiple CI infrastructures. To fix the situation, we can just always pass the host, port, user and password to the tests. The tests can then assemble the complete URL either with or without included credentials, allowing us to test both cases in-process.
| * | tests: perf: build but exclude performance tests by defaultPatrick Steinhardt2018-01-032-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our performance tests (or to be more concrete, our single performance test) are not built by default, as they are always #ifdef'd out. While it is true that we don't want to run performance tests by default, not compiling them at all may cause code rot and is thus an unfavorable approach to handle this. We can easily improve this situation: this commit removes the #ifdef, causing the code to always be compiled. Furthermore, we add `-xperf` to the default command line parameters of `generate.py`, thus causing the tests to be excluded by default. Due to this approach, we are now able to execute the performance tests by passing `-sperf` to `libgit2_clar`. Unfortunately, we cannot execute the performance tests on Travis or AppVeyor as they rely on history being available for the libgit2 repository. As both do a shallow clone only, though, this is not given.
| * | tests: iterator::workdir: fix reference count in stale testPatrick Steinhardt2018-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The test `iterator::workdir::filesystem_gunk` is usually not executed, as it is guarded by the environment variable "GITTEST_INVASIVE_SPEED" due to its effects on speed. As such, it has become stale and does not account for new references which have meanwhile been added to the testrepo, causing it to fail. Fix this by raising the number of expected references to 15.
| * | tests: iterator_helpers: assert number of iterator itemsPatrick Steinhardt2018-01-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the function `expect_iterator_items` surpasses the number of expected items, we simply break the loop. This causes us to trigger an assert later on which has message attached, which is annoying when trying to locate the root error cause. Instead, directly assert that the current count is still smaller or equal to the expected count inside of the loop.
| * | tests: status::worktree: indicate skipped tests on Win32Patrick Steinhardt2018-01-034-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some function bodies of tests which are not applicable to the Win32 platform are completely #ifdef'd out instead of calling `cl_skip()`. This leaves us with no indication that these tests are not being executed at all and may thus cause decreased scrutiny when investigating skipped tests. Improve the situation by calling `cl_skip()` instead of just doing nothing.
* | | Merge pull request #4159 from richardipsum/notes-commitEdward Thomson2017-12-301-0/+274
|\ \ \ | | | | | | | | Support using notes via a commit rather than a ref
| * | | notes: Add test that read of noteless commit failsRichard Ipsum2017-12-021-0/+25
| | | |
| * | | notes: Add git_note_commit_iterator_newRichard Ipsum2017-10-071-0/+43
| | | | | | | | | | | | | | | | This also adds tests for this function.
| * | | notes: Add git_note_commit_removeRichard Ipsum2017-10-071-0/+44
| | | | | | | | | | | | | | | | This also adds tests for this function.
| * | | notes: Add git_note_commit_readRichard Ipsum2017-10-071-0/+40
| | | | | | | | | | | | | | | | This also adds tests for this function.
| * | | notes: Add git_note_commit_createRichard Ipsum2017-10-071-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new function that will allow creation of notes without necessarily updating a particular ref, the notes tree is obtained from the git_commit object parameter, a new commit object pointing to the current tip of the notes tree is optionally returned via the 'note_commit_out' parameter, optionally the blob id for the note is returned through the 'note_blob_out' object.
* | | | Merge pull request #4455 from libgit2/ethomson/branch_symlinksEdward Thomson2017-12-301-18/+66
|\ \ \ \ | | | | | | | | | | refs: traverse symlinked directories
| * | | | refs:iterator: add tests to recurse symlinksethomson/branch_symlinksEdward Thomson2017-12-301-18/+66
| | | | | | | | | | | | | | | | | | | | Ensure that we can recurse into directories via symbolic links.
* | | | | Merge pull request #4443 from libgit2/ethomson/large_loose_blobsEdward Thomson2017-12-302-0/+156
|\ \ \ \ \ | |/ / / / |/| | | | Inflate large loose blobs
| * | | | tests: add GITTEST_SLOW env var checkethomson/large_loose_blobsEdward Thomson2017-12-201-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing very large files may be slow, particularly on inefficient filesystems and when running instrumented code to detect invalid memory accesses (eg within valgrind or similar tools). Introduce `GITTEST_SLOW` so that tests that are slow can be skipped by the CI system.
| * | | | odb_loose: reject objects that cannot fit in memoryEdward Thomson2017-12-201-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check the size of objects being read from the loose odb backend and reject those that would not fit in memory with an error message that reflects the actual problem, instead of error'ing later with an unintuitive error message regarding truncation or invalid hashes.
| * | | | odb: test loose reading/writing large objectsEdward Thomson2017-12-201-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a test for very large objects in the ODB. Write a large object (5 GB) and ensure that the write succeeds and provides us the expected object ID. Introduce a test that writes that file and ensures that we can subsequently read it.
| * | | | util: introduce `git__prefixncmp` and consolidate implementationsEdward Thomson2017-12-201-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce `git_prefixncmp` that will search up to the first `n` characters of a string to see if it is prefixed by another string. This is useful for examining if a non-null terminated character array is prefixed by a particular substring. Consolidate the various implementations of `git__prefixcmp` around a single core implementation and add some test cases to validate its behavior.
* | | | | Merge pull request #4021 from carlosmn/cmn/refspecs-fetchheadEdward Thomson2017-12-281-8/+80
|\ \ \ \ \ | | | | | | | | | | | | FETCH_HEAD and multiple refspecs
| * | | | | fetch: go over FETCH_HEAD just once when counting the prefixes in testCarlos Martín Nieto2017-12-261-21/+26
| | | | | |
| * | | | | fetch: add a failing test for FETCH_HEAD with multiple fetch refspecsCarlos Martín Nieto2017-12-261-0/+59
| | | | | |
| * | | | | fetch: expand fetchhead test to cover providing multiple refspecsCarlos Martín Nieto2017-11-191-8/+16
| | | | | |
* | | | | | Merge pull request #4285 from pks-t/pks/patches-with-whitespaceEdward Thomson2017-12-232-0/+16
|\ \ \ \ \ \ | | | | | | | | | | | | | | patch_parse: fix parsing unquoted filenames with spaces
| * | | | | | patch_parse: allow parsing ambiguous patch headersPatrick Steinhardt2017-11-112-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The git patch format allows for having unquoted paths with whitespaces inside. This format becomes ambiguous to parse, e.g. in the following example: diff --git a/file b/with spaces.txt b/file b/with spaces.txt While we cannot parse this in a correct way, we can instead use the "---" and "+++" lines to retrieve the file names, as the path is not followed by anything here but spans the complete remaining line. Because of this, we can simply bail outwhen parsing the "diff --git" header here without an actual error and then proceed to just take the paths from the other headers.
* | | | | | | Fix unpack double freelhchavez2017-12-231-5/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an element has been cached, but then the call to packfile_unpack_compressed() fails, the very next thing that happens is that its data is freed and then the element is not removed from the cache, which frees the data again. This change sets obj->data to NULL to avoid the double-free. It also stops trying to resolve deltas after two continuous failed rounds of resolution, and adds a test for this.
* | | | | | | Merge pull request #4429 from novalis/delete-modify-submodule-mergeEdward Thomson2017-12-234-0/+39
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | Do not attempt to check out submodule as blob when merging a submodule modify/deltete conflict
| * | | | | | Do not attempt to check out submodule as blob when merging a submodule ↵David Turner2017-12-044-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | modify/deltete conflict
* | | | | | | Merge pull request #4447 from pks-t/pks/diff-file-contents-refcount-blobEdward Thomson2017-12-161-0/+39
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | diff_file: properly refcount blobs when initializing file contents
| * | | | | | | diff_file: properly refcount blobs when initializing file contentsPatrick Steinhardt2017-12-151-0/+39
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When initializing a `git_diff_file_content` from a source whose data is derived from a blob, we simply assign the blob's pointer to the resulting struct without incrementing its refcount. Thus, the structure can only be used as long as the blob is kept alive by the caller. Fix the issue by using `git_blob_dup` instead of a direct assignment. This function will increment the refcount of the blob without allocating new memory, so it does exactly what we want. As `git_diff_file_content__unload` already frees the blob when `GIT_DIFF_FLAG__FREE_BLOB` is set, we don't need to add new code handling the free but only have to set that flag correctly.
* | | | | | | libFuzzer: Fix missing trailer crashlhchavez2017-12-081-0/+17
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes an invalid memory access when the trailer is missing / corrupt. Found using libFuzzer.
* | | | | | libFuzzer: Fix a git_packfile_stream leaklhchavez2017-12-061-0/+27
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change ensures that the git_packfile_stream object in git_indexer_append() does not leak when the stream has errors. Found using libFuzzer.
* | | | | Merge pull request #4318 from Uncommon/amend_statusEdward Thomson2017-12-011-0/+31
|\ \ \ \ \ | | | | | | | | | | | | Add git_status_file_at
| * | | | | status: Add a baseline field to git_status_options for comparing to trees ↵David Catmull2017-11-301-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | other than HEAD
* | | | | | Merge pull request #4298 from tiennou/gather-reflog-messages-testsPatrick Steinhardt2017-11-2410-523/+537
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | Gather the reflog entry content tests