Replies: 1 comment 1 reply
-
Hi @lya001 - if you're using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
So in our codebase, we need to copy a string into a git_buf in the function:
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,
const char *filter_name,
const git_merge_driver_source *src);
This used to be done by calling 'git_buf_set'. However, it is now deprecated.
My workaround is now to set it with "a->ptr = strdup(b);" where a is the git_buf and b is the string.
However, this is a bit 'asymmetric' as the memory is now assigned by the caller(us) but freed by libgit2 when calling "git_buf_dispose".
Does anyone have a better suggestion for how this could be done? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions