summaryrefslogtreecommitdiff
path: root/tests/status
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* diff conflicts: don't include incorrect IDEdward Thomson2015-05-281-0/+46
| | | | | | | | | Since a diff entry only concerns a single entry, zero the information for the index side of a conflict. (The index entry would otherwise erroneously include the lowest-stage index entry - generally the ancestor of a conflict.) Test that during status, the index side of the conflict is empty.
* diff/status: introduce conflictsEdward Thomson2015-05-281-2/+2
| | | | | | | | | | | When diffing against an index, return a new `GIT_DELTA_CONFLICTED` delta type for items that are conflicted. For a single file path, only one delta will be produced (despite the fact that there are multiple entries in the index). Index iterators now have the (optional) ability to return conflicts in the index. Prior to this change, they would be omitted, and callers (like diff) would omit conflicted index entries entirely.
* index: validate mode of new conflictsEdward Thomson2015-05-281-0/+6
|
* conflicts: when adding conflicts, remove stagedEdward Thomson2015-05-281-1/+1
| | | | | | When adding a conflict for some path, remove the staged entry. Otherwise, an illegal index (with both stage 0 and high-stage entries) would result.
* ignore: clear the error when matching a pattern negationcmn/ignored-ignoreCarlos Martín Nieto2015-05-201-0/+12
| | | | | | When we discover that we want to keep a negative rule, make sure to clear the error variable, as it we otherwise return whatever was left by the previous loop iteration.
* status test: always test the new file pathEdward Thomson2015-05-041-8/+12
|
* ignore: fix negative ignores without wildcards.Patrick Steinhardt2015-04-171-0/+53
|
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-1/+1
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-2/+2
| | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* ignore: adjust test for negating inside a dirCarlos Martín Nieto2014-12-051-5/+14
| | | | | | | | | | | | | Given top !top/foo in an ignore file, we should not unignore top/foo. This is an implementation detail of the git code leaking, but that's the behaviour we should show. A negation rule can only negate an exact rule it has seen before.
* Plug leaksCarlos Martín Nieto2014-11-231-0/+1
| | | | Valgrind is now clean except for libssl and libgcrypt.
* Fixed a couple Clang warningsPierre-Olivier Latour2014-11-101-1/+0
|
* git_status_file now takes an exact pathUngureanu Marius2014-11-071-3/+1
| | | | | | This function has one output but can match multiple files, which can be unexpected for the user, which would usually path the exact path of the file he wants the status of.
* submodules: add failing test for stale module entriesCarlos Martín Nieto2014-11-071-0/+48
| | | | | | | | | We consider an entry in .gitmodules to mean that we have a submodule at a particular path, even if HEAD^{tree} and the index do not contain any reference to it. We should ignore that submodule entry and simply consider that path to be a regular directory.