diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-05-27 23:41:11 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-06-05 07:14:24 +0100 |
commit | fa098ce6baaa41153f8fb63eaa1670b67acf74b9 (patch) | |
tree | 05e04b1c3b872e9f32190588d4a5c799bc712f74 | |
parent | 3b6fcc0a57b96e7c4d3a95f057adf7e17e71472a (diff) | |
download | libgit2-fa098ce6baaa41153f8fb63eaa1670b67acf74b9.tar.gz |
merge: user-facing functions write to a userbuf
-rw-r--r-- | include/git2/sys/merge.h | 2 | ||||
-rw-r--r-- | src/merge.c | 2 | ||||
-rw-r--r-- | src/merge_driver.c | 4 | ||||
-rw-r--r-- | src/merge_driver.h | 2 | ||||
-rw-r--r-- | tests/merge/driver.c | 14 |
5 files changed, 12 insertions, 12 deletions
diff --git a/include/git2/sys/merge.h b/include/git2/sys/merge.h index ef4bc5aca..ee5fb5c73 100644 --- a/include/git2/sys/merge.h +++ b/include/git2/sys/merge.h @@ -109,7 +109,7 @@ typedef int GIT_CALLBACK(git_merge_driver_apply_fn)( git_merge_driver *self, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src); diff --git a/src/merge.c b/src/merge.c index 6e3a6c648..6d5521d0f 100644 --- a/src/merge.c +++ b/src/merge.c @@ -876,7 +876,7 @@ static int merge_conflict_invoke_driver( *out = NULL; - if ((error = driver->apply(driver, &path, &mode, &buf, name, src)) < 0 || + if ((error = driver->apply(driver, &path, &mode, (git_userbuf *)&buf, name, src)) < 0 || (error = git_repository_odb(&odb, src->repo)) < 0 || (error = git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJECT_BLOB)) < 0) goto done; diff --git a/src/merge_driver.c b/src/merge_driver.c index 666349b15..021f6227d 100644 --- a/src/merge_driver.c +++ b/src/merge_driver.c @@ -66,7 +66,7 @@ int git_merge_driver__builtin_apply( git_merge_driver *self, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src) { @@ -117,7 +117,7 @@ static int merge_driver_binary_apply( git_merge_driver *self, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src) { diff --git a/src/merge_driver.h b/src/merge_driver.h index 6b7da5287..4ebd22d6d 100644 --- a/src/merge_driver.h +++ b/src/merge_driver.h @@ -46,7 +46,7 @@ extern int git_merge_driver__builtin_apply( git_merge_driver *self, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src); diff --git a/tests/merge/driver.c b/tests/merge/driver.c index a3fececb4..3d35f07da 100644 --- a/tests/merge/driver.c +++ b/tests/merge/driver.c @@ -67,7 +67,7 @@ static int test_driver_apply( git_merge_driver *s, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src) { @@ -77,8 +77,8 @@ static int test_driver_apply( *path_out = "applied.txt"; *mode_out = GIT_FILEMODE_BLOB; - return git_buf_printf(merged_out, "This is the `%s` driver.\n", - filter_name); + return git_buf_printf((git_buf *)merged_out, + "This is the `%s` driver.\n", filter_name); } static struct test_merge_driver test_driver_custom = { @@ -172,11 +172,11 @@ void test_merge_driver__shutdown_is_called(void) test_driver_custom.shutdown = 0; test_driver_wildcard.initialized = 0; test_driver_wildcard.shutdown = 0; - + /* run the merge with the custom driver */ set_gitattributes_to("custom"); merge_branch(); - + /* unregister the drivers, ensure their shutdown function is called */ test_drivers_unregister(); @@ -196,7 +196,7 @@ static int defer_driver_apply( git_merge_driver *s, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src) { @@ -241,7 +241,7 @@ static int conflict_driver_apply( git_merge_driver *s, const char **path_out, uint32_t *mode_out, - git_buf *merged_out, + git_userbuf *merged_out, const char *filter_name, const git_merge_driver_source *src) { |