summaryrefslogtreecommitdiff
path: root/tests/status/worktree.c
Commit message (Collapse)AuthorAgeFilesLines
* tests: declare functions statically where appropriateEdward Thomson2021-11-111-1/+1
|
* path: separate git-specific path functions from utilEdward Thomson2021-11-091-5/+5
| | | | | | 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-171-42/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-201-1/+1
| | | | | | | | | 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.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-1/+1
| | | | Use the new object_type enumeration names within the codebase.
* index: use new enum and structure namesEdward Thomson2018-12-011-3/+3
| | | | Use the new-style index names throughout our own codebase.
* treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-131-2/+2
| | | | | | | | | 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.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-8/+8
|
* 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: 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.
* 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-171-5/+5
| | | | | | | | | | | | 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.
* 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.
* Don't include the unreadable tests on win32Edward Thomson2014-08-131-0/+4
|
* 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
|
* 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.
* Remove trace / add git_diff_perfdata struct + apiRussell Belfer2014-05-021-39/+36
|
* Add payloads, bitmaps to trace APIRussell Belfer2014-05-021-27/+5
| | | | | | | | | This is a proposed adjustment to the trace APIs. This makes the trace levels into a bitmask so that they can be selectively enabled and adds a callback-level payload, plus a message-level payload. This makes it easier for me to a GIT_TRACE_PERF callbacks that are simply bypassed if the PERF level is not set.
* Don't use trace if GIT_TRACE not definedRussell Belfer2014-05-021-0/+6
|
* Add GIT_STATUS_OPT_UPDATE_INDEX and use trace APIRussell Belfer2014-05-021-7/+84
| | | | | | This adds an option to refresh the stat cache while generating status. It also rips out the GIT_PERF stuff I had an makes use of the trace API to keep statistics about what happens during diff.
* Skip diff oid calc when size definitely changedRussell Belfer2014-05-021-1/+5
| | | | | | | | | | | | | When we think the stat cache in the index seems valid and the size or mode of a file has definitely changed, then don't bother trying to recalculate the OID of the workdir bits to confirm that it is modified - just accept that it is modified. This can result in files that show as modified with no actual diff, but the behavior actually appears to match Git on the command line. This also includes a minor optimization to not perform a submodule lookup on the ".git" directory itself.
* index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-6/+6
| | | | This was not converted when we converted the rest, so do it now.
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Rename tests-clar to testsBen Straub2013-11-141-0/+875