summaryrefslogtreecommitdiff
path: root/tests/status
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* ignore: add failing test for a file mentioning the parentCarlos Martín Nieto2014-11-061-0/+32
| | | | | When we mention "src" in src/.gitignore, we wrongly consider src/ itself to be ignored.
* ignore: consider files with a CR in their namescmn/ignore-file-trailing-crCarlos Martín Nieto2014-11-051-0/+32
| | | | | | | | | | We currently consider CR to start the end of the line, but that means that we miss cases with CR CR LF which can be used with git to match files whose names have CR at the end of their names. The fix from the patch comes from Russell's comment in the issue. This fixes #2536.
* Merge pull request #2508 from libgit2/rb/fix-ignore-slash-starVicent Marti2014-08-261-0/+95
|\ | | | | Fix bugs with negative ignores inside an ignored parent directory
| * Demonstrate a trailing slash failure.rb/fix-ignore-slash-starRob Rix2014-08-081-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `git help ignore` has this to say about trailing slashes: > If the pattern ends with a slash, it is removed for the purpose of > the following description, but it would only find a match with a > directory. In other words, foo/ will match a directory foo and > paths underneath it, but will not match a regular file or a > symbolic link foo (this is consistent with the way how pathspec > works in general in Git). Sure enough, having manually performed the same steps as this test, `git status` tells us the following: # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: force.txt # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # ../.gitignore # child1/ # child2/ i.e. neither child1 nor child2 is ignored.
| * status: failing test with slash-starCarlos Martín Nieto2014-08-081-0/+38
| | | | | | | | | | | | | | When writing 'bin/*' in the rules, this means we ignore very file inside bin/ individually, but do not ignore the directory itself. Thus the status listing should list both files under bin/, one untracked and one ignored.
* | Don't include the unreadable tests on win32Edward Thomson2014-08-131-0/+4
|/
* Merge remote-tracking branch 'origin/master' into ↵Alan Rogers2014-07-221-2/+2
|\ | | | | | | fix-git-status-list-new-unreadable-folder
| * Introduce cl_assert_equal_oidEdward Thomson2014-07-011-2/+2
| |
* | Merge remote-tracking branch 'origin/development' into ↵Alan Rogers2014-06-041-0/+107
|\ \ | |/ | | | | | | | | | | fix-git-status-list-new-unreadable-folder Conflicts: include/git2/diff.h
| * Improve checks for ignore containmentrb/how-broken-can-ignores-beRussell Belfer2014-05-061-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The diff code was using an "ignored_prefix" directory to track if a parent directory was ignored that contained untracked files alongside tracked files. Unfortunately, when negative ignore rules were used for directories inside ignored parents, the wrong rules were applied to untracked files inside the negatively ignored child directories. This commit moves the logic for ignore containment into the workdir iterator (which is a better place for it), so the ignored-ness of a directory is contained in the frame stack during traversal. This allows a child directory to override with a negative ignore and yet still restore the ignored state of the parent when we traverse out of the child. Along with this, there are some problems with "directory only" ignore rules on container directories. Given "a/*" and "!a/b/c/" (where the second rule is a directory rule but the first rule is just a generic prefix rule), then the directory only constraint was having "a/b/c/d/file" match the first rule and not the second. This was fixed by having ignore directory-only rules test a rule against the prefix of a file with LEADINGDIR enabled. Lastly, spot checks for ignores using `git_ignore_path_is_ignored` were tested from the top directory down to the bottom to deal with the containment problem, but this is wrong. We have to test bottom to top so that negative subdirectory rules will be checked before parent ignore rules. This does change the behavior of some existing tests, but it seems only to bring us more in line with core Git, so I think those changes are acceptable.
* | Add another test for unreadable and not included.Alan Rogers2014-06-041-0/+32
| |
* | Add GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKEDAlan Rogers2014-06-031-1/+36
| | | | | | | | and a (failing) test for it.
* | Fix the no permissions test.Alan Rogers2014-05-301-3/+2
| |
* | Use 'X' for unreadable status.Alan Rogers2014-05-301-0/+3
| |
* | We do expect the foo path in the nopermissions testAlan Rogers2014-05-231-2/+2
| |
* | Remove errant newlineAlan Rogers2014-05-221-1/+0
| |
* | Simplify the no permission test.Alan Rogers2014-05-211-6/+4
| |
* | Skip unreadable files for now.Alan Rogers2014-05-151-2/+5
| |
* | Simplify the test.Alan Rogers2014-05-151-10/+5
| |
* | Add a test (failing) for a work tree status.Alan Rogers2014-05-141-0/+38
|/ | | | | When thees is an unreadable folder, we should still be able to enumerate status.