summaryrefslogtreecommitdiff
path: root/tests/apply/workdir.c
Commit message (Collapse)AuthorAgeFilesLines
* tests: apply: fix missing `cl_git_pass` wrappersPatrick Steinhardt2018-11-131-1/+1
| | | | | | Some function calls in the new "apply" test suite were missing the checks whether they succeeded as expected. Fix this by adding the missing `cl_git_pass` wrappers.
* apply tests: tests a diff w/ many small changesEdward Thomson2018-11-051-0/+52
|
* apply: move location to an argument, not the optsEdward Thomson2018-11-051-10/+9
| | | | | | | | Move the location option to an argument, out of the options structure. This allows the options structure to be re-used for functions that don't need to know the location, since it's implicit in their functionality. For example, `git_apply_tree` should not take a location, but is expected to take all the other options.
* apply tests: ensure mode changes occurEdward Thomson2018-11-051-0/+28
| | | | Test that a mode change is reflected in the working directory or index.
* apply tests: ensure we can patch a modified fileEdward Thomson2018-11-051-0/+34
| | | | | | | | Patch application need not be on an unmodified file; applying to an already changed file is supported provided the patch still applies cleanly. Add tests that modifies the contents of a file then applies the patch and ensures that the patch applies cleanly, and the original changes are also kept.
* apply test: apply with non-conflicting changesEdward Thomson2018-11-051-0/+27
| | | | | | Ensure that we can apply to the working directory or the index when the application target is modified, so long as there are not conflicting changes to the items.
* apply tests: move helpers into common areaEdward Thomson2018-11-041-152/+1
|
* apply: test that failures don't dirty workdirEdward Thomson2018-11-041-0/+29
| | | | | | | | | | Ensure that when a patch application fails (due to a conflict in the working directory, for example) that we do not half-apply the patch or otherwise leave the working directory dirty. This is rather obvious in our current apply implementation (we do a two step process: one to create the post-image and one to check it out) but this test is a safety net for future refactoring or improvements.
* apply: test a patch can be applied even with a modified indexEdward Thomson2018-11-041-22/+15
| | | | | | | Ensure that we can apply a patch to the working directory, even to files that are modified in the index (as long as the working directory contents match the preimage - such that the working directory is unmodified from HEAD).
* apply: test that the index is not modifiedEdward Thomson2018-11-041-0/+76
| | | | | Ensure that by default, when using GIT_APPLY_LOCATION_WORKDIR, that patch application does not update the index, only the working directory.
* apply tests: separate common patch hunksEdward Thomson2018-11-041-73/+59
| | | | | | | Move the commonly-used patch hunks into a single constant location. This allows us to avoid re-declaring them in each test, and allows us to compose them to build a larger patch file that includes all the hunks.
* apply tests: use `git_iterator_foreach` for testsEdward Thomson2018-11-041-51/+69
| | | | | | | | Use the new `git_iterator_foreach` API to validate the workdir against the expected workdir values instead of using the paired/multi iterator comparison callback. This allows us to use the `git_iterator_foreach` to validate the index as well, instead of assuming that the index and HEAD must always match.
* apply: handle file additionsEdward Thomson2018-11-041-4/+49
| | | | | | Don't attempt to read the postimage file during a file addition, simply use an empty buffer as the postimage. Also, test that we can handle file additions.
* apply: handle file deletionsEdward Thomson2018-11-041-0/+49
| | | | | | If the file was deleted in the postimage, do not attempt to update the target. Instead, ignore it and simply allow it to stay removed in our computed postimage. Also, test that we can handle file deletions.
* apply: test `git_apply` with a parsed patchEdward Thomson2018-11-041-0/+49
| | | | | Ensure that we can apply a simple patch to the working directory when we have parsed it from a patch file.
* apply: test `git_apply` application to a workdirEdward Thomson2018-11-041-0/+124
Introduce a standard test applying a diff to a working directory with no complications.