summaryrefslogtreecommitdiff
path: root/tests/status
Commit message (Collapse)AuthorAgeFilesLines
* status: don't use `// ...` in tests, use `/* ... */`Edward Thomson2022-01-061-5/+4
|
* Merge remote-tracking branch 'pr/6159'Edward Thomson2022-01-061-0/+62
|\
| * #6154 git_status_list_new case insensitive fixMiguel Arroz2022-01-011-0/+61
| |
* | status: don't use `// ...` in tests, use `/* ... */`Edward Thomson2022-01-061-15/+15
| |
* | Add `rename_threshold` to `git_status_options`.Miguel Arroz2021-12-311-0/+63
|/
* tests: declare functions statically where appropriateEdward Thomson2021-11-111-1/+1
|
* path: separate git-specific path functions from utilEdward Thomson2021-11-092-11/+11
| | | | | | 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-172-48/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Consider files executable only if the user can execute themDavid Turner2021-06-161-0/+39
| | | | This is what git.git does, so we should follow suit.
* Make the tests pass cleanly with MemorySanitizerlhchavez2020-06-301-1/+1
| | | | | | | | | 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`.
* clar: include the function nameethomson/clar_tapEdward Thomson2020-06-052-2/+4
|
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-203-3/+3
| | | | | | | | | 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.
* tests: unify ignore tests into their own dirPatrick Steinhardt2019-06-071-1292/+0
| | | | | | | | | | | | | We had several occasions where tests for the gitignore had been added to status::ignore instead of the easier-to-handle attr::ignore test suite. This most likely resulted from the fact that the attr::ignore test suite is not easy to discover inside of the attr folder. Furthermore, ignore being part of the attributes code is an implementation detail, only, and thus shouldn't be stressed as much. Improve this by moving both attr::ignore and status::ignore tests into a new ignore test suite.
* tests: remove accidentally checked in backup filePatrick Steinhardt2019-06-071-1268/+0
| | | | | | | The "ignore.c.bak" file has accidentally been checked in via commit 191649010 (ignore: test that leading whitespace is significant, 2019-05-19) and should obviously not be part of our test suites. Delete it.
* Merge pull request #5074 from libgit2/ethomson/ignore_leading_slashEdward Thomson2019-06-061-0/+24
|\ | | | | Ignore: only treat one leading slash as a root identifier
| * ignore: test multiple leading slashesEdward Thomson2019-05-191-0/+24
| |
* | ignore: test that comments begin at position 0Edward Thomson2019-05-241-0/+4
| | | | | | | | | | | | Comments must have a '#' at the beginning of the line. For compatibility with git, '#' after a whitespace is a literal part of the filename.
* | ignore: test that leading whitespace is significantEdward Thomson2019-05-242-0/+1294
| | | | | | | | | | | | Ensure that leading whitespace is treated as being part of the filename, eg ` foo` in an ignore file indicates that a file literally named ` foo` is ignored.
* | ignore: test we can handle an ignore file with BOMEdward Thomson2019-05-191-0/+23
|/ | | | Ensure that we can read and parse an ignore file with a UTF8 BOM.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-012-3/+3
| | | | Use the new object_type enumeration names within the codebase.
* index: use new enum and structure namesEdward Thomson2018-12-013-6/+6
| | | | Use the new-style index names throughout our own codebase.
* treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-132-3/+3
| | | | | | | | | C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
* Merge pull request #4436 from pks-t/pks/packfile-stream-freeEdward Thomson2018-06-113-11/+11
|\ | | | | pack: rename `git_packfile_stream_free`
| * Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-103-11/+11
| |
* | ignore: fix negative leading directory rules unignoring subdirectory filesPatrick Steinhardt2018-06-061-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When computing whether a file is ignored, we simply search for the first matching rule and return whether it is a positive ignore rule (the file is really ignored) or whether it is a negative ignore rule (the file is being unignored). Each rule has a set of flags which are being passed to `fnmatch`, depending on what kind of rule it is. E.g. in case it is a negative ignore we add a flag `GIT_ATTR_FNMATCH_NEGATIVE`, in case it contains a glob we set the `GIT_ATTR_FNMATCH_HASGLOB` flag. One of these flags is the `GIT_ATTR_FNMATCH_LEADINGDIR` flag, which is always set in case the pattern has a trailing "/*" or in case the pattern is negative. The flag causes the `fnmatch` function to return a match in case a string is a leading directory of another, e.g. "dir/" matches "dir/foo/bar.c". In case of negative patterns, this is wrong in certain cases. Take the following simple example of a gitignore: dir/ !dir/ The `LEADINGDIR` flag causes "!dir/" to match "dir/foo/bar.c", and we correctly unignore the directory. But take this example: *.test !dir/* We expect everything in "dir/" to be unignored, but e.g. a file in a subdirectory of dir should be ignored, as the "*" does not cross directory hierarchies. With `LEADINGDIR`, though, we would just see that "dir/" matches and return that the file is unignored, even if it is contained in a subdirectory. Instead, we want to ignore leading directories here and check "*.test". Afterwards, we have to iterate up to the parent directory and do the same checks. To fix the issue, disallow matching against leading directories in gitignore files. This can be trivially done by just adding the `GIT_ATTR_FNMATCH_NOLEADINGDIR` to the spec passed to `git_attr_fnmatch__parse`. Due to a bug in that function, though, this flag is being ignored for negative patterns, which is fixed in this commit, as well. As a last fix, we need to ignore rules that are supposed to match a directory when our path itself is a file. All together, these changes fix the described error case.
* | tests: status::ignore: fix style of a testPatrick Steinhardt2018-06-061-20/+15
|/
* 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.
* Merge pull request #4257 from pks-t/pks/stale-testEdward Thomson2018-01-031-0/+4
|\ | | | | Execute stale tests
| * tests: status::worktree: indicate skipped tests on Win32Patrick Steinhardt2018-01-031-0/+4
| | | | | | | | | | | | | | | | | | 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.
* | status: Add a baseline field to git_status_options for comparing to trees ↵David Catmull2017-11-301-0/+31
|/ | | | other than HEAD
* tests: status: additional test for negative ignores with patternPatrick Steinhardt2017-08-251-0/+27
| | | | This test is by Carlos Martín Nieto.
* Fix issue with directory glob ignore in subdirectoriesRobert Gay2017-05-171-0/+78
|
* `cl_git_exec` -> `cl_git_expect`ethomson/clar_messagesEdward Thomson2017-02-171-1/+1
|
* tests: provide better pass/failure error messagesEdward Thomson2017-02-171-2/+2
| | | | | | Provide more detailed messages when conditions pass or fail unexpectedly. In particular, this provides the error messages when a test fails with a different error code than was expected.
* ignore: allow unignoring basenames in subdirectoriesPatrick Steinhardt2016-08-121-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .gitignore file allows for patterns which unignore previous ignore patterns. When unignoring a previous pattern, there are basically three cases how this is matched when no globbing is used: 1. when a previous file has been ignored, it can be unignored by using its exact name, e.g. foo/bar !foo/bar 2. when a file in a subdirectory has been ignored, it can be unignored by using its basename, e.g. foo/bar !bar 3. when all files with a basename are ignored, a specific file can be unignored again by specifying its path in a subdirectory, e.g. bar !foo/bar The first problem in libgit2 is that we did not correctly treat the second case. While we verified that the negative pattern matches the tail of the positive one, we did not verify if it only matches the basename of the positive pattern. So e.g. we would have also negated a pattern like foo/fruz_bar !bar Furthermore, we did not check for the third case, where a basename is being unignored in a certain subdirectory again. Both issues are fixed with this commit.
* tests: skip the unreadable file tests as rootEdward Thomson2016-04-111-0/+3
| | | | | | 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.
* Merge pull request #3719 from libgit2/ethomson/submodule_statusCarlos Martín Nieto2016-04-011-0/+37
|\ | | | | WD iterator: properly identify submodules
| * status: test submodules with mixed caseEdward Thomson2016-03-311-0/+37
| |
* | leaks: fix some leaks in the testsEdward Thomson2016-03-311-2/+8
|/
* Failing test.joshaber2016-03-231-10/+53
|
* iterator: test pathlist handling for directoriesMarc Strapetz2016-03-231-0/+82
| | | | | | | | | | | | | tree_iterator was only working properly for a pathlist containing file paths. In case of directory paths, it didn't match children which contradicts GIT_DIFF_DISABLE_PATHSPEC_MATCH and is different from index_iterator and fs_iterator. As a consequence head-to-index status reporting for a specific directory did not work properly -- all files have been reported as added. Include additional tests.
* status: update test to include valid OIDEdward Thomson2016-03-231-1/+1
|
* git_futils_mkdir_*: make a relative-to-base mkdirEdward Thomson2015-09-172-12/+12
| | | | | | | | | | | | Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter assumes that we own everything beneath the base, as if it were being called with a base of the repository or working directory, and is tailored towards checkout and ensuring that there is no bogosity beneath the base that must be cleaned up. This is (at best) slow and (at worst) unsafe in the larger context of a filesystem where we do not own things and cannot do things like unlink symlinks that are in our way.
* Merge branch 'cmn/ignore-dir-check'Carlos Martín Nieto2015-09-131-0/+17
|\
| * ignore: add test and adjust style and comment for dir with wildmatchCarlos Martín Nieto2015-09-131-0/+17
| | | | | | | | | | | | The previous commit left the comment referencing the earlier state of the code, change it to explain the current logic. While here, change the logic to avoid repeating the copy of the base pattern.
* | status test: brackets are now literalEdward Thomson2015-08-301-2/+2
|/
* diff: check files with the same or newer timestampsCarlos Martín Nieto2015-06-221-0/+2
| | | | | | | | | | When a file on the workdir has the same or a newer timestamp than the index, we need to perform a full check of the contents, as the update of the file may have happened just after we wrote the index. The iterator changes are such that we can reach inside the workdir iterator from the diff, though it may be better to have an accessor instead of moving these structs into the header.
* status: test that symlinks don't lose their modeEdward Thomson2015-06-201-0/+48
| | | | | | Test to ensure that when status updates an index, it does not alter the original mode for file types that are not supported (eg, symlinks on Windows).
* tests: tick the index when we count OID calculationsCarlos Martín Nieto2015-06-161-0/+6
| | | | | | | | | These tests want to test that we don't recalculate entries which match the index already. This is however something we force when truncating racily-clean entries. Tick the index forward as we know that we don't perform the modifications which the racily-clean code is trying to avoid.
* Fixed build warnings on Xcode 6.1Pierre-Olivier Latour2015-06-021-2/+2
|