Commit Graph

10 Commits

Author SHA1 Message Date
Edward Thomson
d525e063ba buf: remove internal git_buf_text namespace
The `git_buf_text` namespace is unnecessary and strange.  Remove it,
just keep the functions prefixed with `git_buf`.
2021-05-11 01:29:22 +01:00
Max Kostyukevich
585fbd74d2 apply: Test for EOFNL mishandling when several hunks are processed
Introduce an unit test to validate that git_apply__patch() properly
handles EOFNL changes in case of patches with several hunks.
2019-08-28 23:18:31 +03:00
Patrick Steinhardt
966b944095 tests: apply: verify that we correctly truncate the source buffer
Previously, we would fail to correctly truncate the source buffer
if the source has more than one line and ends with a non-newline
character. In the following call, we thus truncate the source
string in the middle of the second line. Without the bug fixed,
we would successfully apply the patch to the source and return
success. With the overflow being fixed, we should return an
error now.
2019-02-21 09:24:25 +01:00
Jason Haslam
7263057269 patch: add support for partial patch application
Add hunk callback parameter to git_apply__patch to allow hunks to be skipped.
2018-11-05 15:53:59 +00:00
Edward Thomson
47cc5f85e9 apply: introduce a hunk callback
Introduce a callback to patch application that allows consumers to
cancel hunk application.
2018-11-05 15:53:59 +00:00
Patrick Steinhardt
ecf4f33a4e Convert usage of git_buf_free to new git_buf_dispose 2018-06-10 19:34:37 +02:00
Edward Thomson
8bca8b9e03 apply: move patch data to patch_common.h 2016-05-26 13:01:04 -05:00
Edward Thomson
3149ff6f66 patch application: apply binary patches
Handle the application of binary patches.  Include tests that
produce a binary patch (an in-memory `git_patch` object),
then enusre that the patch applies correctly.
2016-05-26 13:01:03 -05:00
Edward Thomson
0004386f29 apply: handle empty patches
When a patch is empty, simply copy the source into the destination.
2016-05-26 11:36:11 -05:00
Edward Thomson
7cb904ba44 Introduce git_apply_patch
The beginnings of patch application from an existing (diff-created)
git_patch object: applies the hunks of a git_patch to a buffer.
2016-05-26 11:36:11 -05:00