summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* git_index_add_frombuffer: only accept files/linksethomson/index_add_requires_filesEdward Thomson2018-02-181-0/+61
| | | | | | | Ensure that the buffer given to `git_index_add_frombuffer` represents a regular blob, an executable blob, or a link. Explicitly reject commit entries (submodules) - it makes little sense to allow users to add a submodule from a string; there's no possible path to success.
* odb: error when we can't create object headerEdward Thomson2018-02-091-3/+3
| | | | | Return an error to the caller when we can't create an object header for some reason (printf failure) instead of simply asserting.
* Merge pull request #4450 from libgit2/ethomson/odb_loose_readstreamEdward Thomson2018-02-082-1/+160
|\ | | | | Streaming read support for the loose ODB backend
| * odb_loose: largefile tests only on 64 bit platformsEdward Thomson2018-02-011-1/+14
| | | | | | | | | | | | | | | | Only run the large file tests on 64 bit platforms. Even though we support streaming reads on objects, and do not need to fit them in memory, we use `size_t` in various places to reflect the size of an object.
| * odb_loose: test read_header on large blobsEdward Thomson2018-02-011-0/+16
| | | | | | | | | | | | Test that we can read_header on large blobs. This should succeed on all platforms since we read only a few bytes into memory to be able to parse the header.
| * odb_loose: test read_header explicitlyEdward Thomson2018-02-011-0/+30
| |
| * odb: test loose object streamingEdward Thomson2018-02-011-0/+54
| |
| * odb_loose: test reading a large file in streamEdward Thomson2018-02-011-1/+47
| | | | | | | | | | | | Since some test situations may have generous disk space, but limited RAM (eg hosted build agents), test that we can stream a large file into a loose object, and then stream it out of the loose object storage.
* | Merge pull request #4491 from libgit2/ethomson/recursiveEdward Thomson2018-02-0897-21/+89
|\ \ | | | | | | Recursive merge: reverse the order of merge bases
| * | Add failing test case for virtual commit merge base issueEdward Thomson2018-02-0427-0/+32
| | |
| * | merge::trees::recursive: test for virtual base buildingEdward Thomson2018-02-041-0/+25
| | | | | | | | | | | | | | | Virtual base building: ensure that the virtual base is created and revwalked in the same way as git.
| * | merge: reverse merge bases for recursive mergeEdward Thomson2018-02-043-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the commits being merged have multiple merge bases, reverse the order when creating the virtual merge base. This is for compatibility with git's merge-recursive algorithm, and ensures that we build identical trees. Git does this to try to use older merge bases first. Per 8918b0c: > It seems to be the only sane way to do it: when a two-head merge is > done, and the merge-base and one of the two branches agree, the > merge assumes that the other branch has something new. > > If we start creating virtual commits from newer merge-bases, and go > back to older merge-bases, and then merge with newer commits again, > chances are that a patch is lost, _because_ the merge-base and the > head agree on it. Unlikely, yes, but it happened to me.
| * | Introduce additional criss-cross merge branchesEdward Thomson2018-02-0468-0/+11
| | |
* | | config_parse: fix reading files with BOMPatrick Steinhardt2018-02-081-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function `skip_bom` is being used to detect and skip BOM marks previously to parsing a configuration file. To do so, it simply uses `git_buf_text_detect_bom`. But since the refactoring to use the parser interface in commit 9e66590bd (config_parse: use common parser interface, 2017-07-21), the BOM detection was actually broken. The issue stems from a misunderstanding of `git_buf_text_detect_bom`. It was assumed that its third parameter limits the length of the character sequence that is to be analyzed, while in fact it was an offset at which we want to detect the BOM. Fix the parameter to be `0` instead of the buffer length, as we always want to check the beginning of the configuration file.
* | | config_parse: handle empty lines with CRLFPatrick Steinhardt2018-02-081-0/+30
|/ / | | | | | | | | | | | | Currently, the configuration parser will fail reading empty lines with just an CRLF-style line ending. Special-case the '\r' character in order to handle it the same as Unix-style line endings. Add tests to spot this regression in the future.
* | Merge pull request #4489 from libgit2/ethomson/conflicts_crlfEdward Thomson2018-02-041-0/+48
|\ \ | |/ |/| Conflict markers should match EOL style in conflicting files
| * merge: test CR/LF conflicts for CR/LF filesethomson/conflicts_crlfEdward Thomson2018-01-211-0/+48
| | | | | | | | | | | | Ensure that when the files being merged have CR/LF line endings that the conflict markers produced in the conflict file also have CR/LF line endings.
* | Merge pull request #4488 from libgit2/ethomson/conflict_marker_sizeEdward Thomson2018-01-313-8/+8
|\ \ | | | | | | Use longer conflict markers in recursive merge base
| * | merge: recursive uses larger conflict markersEdward Thomson2018-01-213-8/+8
| |/ | | | | | | | | | | | | | | | | | | | | Git uses longer conflict markers in the recursive merge base - two more than the default (thus, 9 character long conflict markers). This allows users to tell the difference between the recursive merge conflicts and conflicts between the ours and theirs branches. This was introduced in git d694a17986a28bbc19e2a6c32404ca24572e400f. Update our tests to expect this as well.
* | Merge pull request #4490 from libgit2/ethomson/apfs_precompose_fixesEdward Thomson2018-01-311-1/+7
|\ \ | | | | | | status::renames: test update for APFS (write NFD instead of NFC filename)
| * | 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.
* | odb: reject reading and writing null OIDsPatrick Steinhardt2018-01-261-0/+18
| | | | | | | | | | | | | | | | | | The null OID (hash with all zeroes) indicates a missing object in upstream git and is thus not a valid object ID. Add defensive measurements to avoid writing such a hash to the object database in the very unlikely case where some data results in the null OID. Furthermore, add shortcuts when reading the null OID from the ODB to avoid ever returning an object when a faulty repository may contain the null OID.
* | tree: reject writing null-OID entries to a treePatrick Steinhardt2018-01-261-0/+11
|/ | | | | | | | | | | | In commit a96d3cc3f (cache-tree: reject entries with null sha1, 2017-04-21), the git.git project has changed its stance on null OIDs in tree objects. Previously, null OIDs were accepted in tree entries to help tools repair broken history. This resulted in some problems though in that many code paths mistakenly passed null OIDs to be added to a tree, which was not properly detected. Align our own code base according to the upstream change and reject writing tree entries early when the OID is all-zero.
* 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