summaryrefslogtreecommitdiff
path: root/tests/iterator
Commit message (Collapse)AuthorAgeFilesLines
* path: separate git-specific path functions from utilEdward Thomson2021-11-092-2/+2
| | | | | | Introduce `git_fs_path`, which operates on generic filesystem paths. `git_path` will be kept for only git-specific path functionality (for example, checking for `.git` in a path).
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-173-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
* tests: don't generate false positives on empty path segmentsPeter Pettersson2021-08-081-1/+1
|
* tests: iterator: fix iterator expecting too few itemsPatrick Steinhardt2020-02-071-9/+9
| | | | | | | | | | | The testcase iterator::workdir::filesystem_gunk sets up quite a lot of directories, which is why it only runs in case GITTEST_INVASIVE_SPEED is set in the environment. Because we do not run our default CI with this variable, we didn't notice commit 852c83ee4 (refs: refuse to delete HEAD, 2020-01-15) breaking the test as it introduced a new reference to the "testrepo" repository. Fix the oversight by increasing the number of expected iterator items.
* refs: refuse to delete HEADJosh Bleecher Snyder2020-01-151-1/+2
| | | | | | | This requires adding a new symbolic ref to the testrepo fixture. Some of the existing tests attempt to delete HEAD, expecting a different failure. Introduce and use a non-HEAD symbolic ref instead. Adjust a few other tests as needed. Fixes #5357
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-204-4/+4
| | | | | | | | | Our file utils functions all have a "futils" prefix, e.g. `git_futils_touch`. One would thus naturally guess that their definitions and implementation would live in files "futils.h" and "futils.c", respectively, but in fact they live in "fileops.h". Rename the files to match expectations.
* attr: ensure regular attr files can have whitespaceethomson/ignore_spacesEdward Thomson2019-05-241-1/+1
| | | | | | Unlike ignore files, gitattribute files can have flexible whitespace at the beginning of the line. Ensure that by adding new ignore rules that we have not impeded correct parsing of attribute files.
* tests: fix test expectation mismatchEtienne Samson2019-01-141-2/+2
|
* index: use new enum and structure namesEdward Thomson2018-12-011-12/+12
| | | | Use the new-style index names throughout our own codebase.
* iterator: optionally hash filesystem iteratorsEdward Thomson2018-11-031-0/+46
| | | | | | | | | Optionally hash the contents of files encountered in the filesystem or working directory iterators. This is not expected to be used in production code paths, but may allow us to simplify some test contexts. For working directory iterators, apply filters as appropriate, since we have the context able to do it.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-103-5/+5
|
* tests: iterator::workdir: fix GCC warningPatrick Steinhardt2018-05-041-1/+1
| | | | | | | | | | | | | | | | | Since GCC 8.1, the compiler performs some bounds checking when copying static data into arrays with a known size. In one test, we print a format string of "%s/sub%02d" into a buffer of 64 bytes. The input buffer for the first "%s" is bounded to at most 63 characters, plus four bytes for the static string "/sub" plus two more bytes for "%02d". Thus, our target buffer needs to be at least 70 bytes in size, including the NUL byte. There seems to be a bug in the analysis, though, because GCC will not account for the limiting "%02" prefix, treating it as requiring the same count of bytes as a "%d". Thus, we end up at 79 bytes that are required to fix the warning. To make it look nicer and less special, we just round the buffer size up to 80 bytes.
* testrepo: add new branchEdward Thomson2018-02-231-1/+2
| | | | | | Add a new branch to the `testrepo` repository, where the `README` file has changed to executable. This branch enables typechange tests between the new `executable` branch and `master`.
* 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-031-0/+2
| | | | | | | | | 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.
* tests: add merge-conflict branch for testrepoPatrick Steinhardt2017-02-131-1/+2
| | | | | Add a new branch that causes a merge conflict to `testrepo` so that we are able to test merging in worktrees.
* tests: add worktree test dataPatrick Steinhardt2017-02-131-1/+2
|
* tests: use a `size_t`Edward Thomson2016-07-242-8/+6
|
* tests: skip the unreadable file tests as rootEdward Thomson2016-04-111-0/+5
| | | | | | When running as root, skip the unreadable file tests, because, well, they're probably _not_ unreadable to root unless you've got some crazy NSA clearance-level honoring operating system shit going on.
* iterator: support trailing `/` in start for submodEdward Thomson2016-04-021-6/+12
| | | | | | Allow callers to specify a start path with a trailing slash to match a submodule, instead of just a directory. This is for some legacy behavior that's sort of dumb, but there it is.
* leaks: fix some leaks in the testsEdward Thomson2016-03-313-0/+8
|
* iterator: new workdir-iterator test for pathlist + includings treesMarc Strapetz2016-03-241-0/+26
|
* iterator: new index-iterator test for pathlist + includings treesMarc Strapetz2016-03-241-0/+31
|
* iterator: more pathlist-related tests should test actual pathsMarc Strapetz2016-03-242-6/+23
|
* iterator: don't run the gunk test by default on CIEdward Thomson2016-03-241-1/+1
| | | | (It's slow!)
* iterator: refactor index iteratorEdward Thomson2016-03-244-58/+688
|
* iterator: give the tests a proper hierarchyEdward Thomson2016-03-245-0/+3375
Iterator tests were split over repo::iterator and diff::iterator, with duplication between the two. Move them to iterator::index, iterator::tree, and iterator::workdir.