Skip to content

Require libgit2 1.4.0+. Remove data_buffer methods #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2022
Merged

Conversation

craigds
Copy link
Member

@craigds craigds commented Mar 1, 2022

This change is slightly backward incompatible. libgit2 1.4.0 made a
chagne to the git_buf structure and deprecated a bunch of associated
functions, to the effect that git_buf is no longer modifiable by
users. It is expected that git_buf should only be set by libgit2
itself as a return from various functions.

So this change to the data_buffer class removes all modifier methods.
A data_buffer is returned where libgit2 returns a git_buf, but we no
longer allow the caller to modify the buffer data or grow the buffer.

related: libgit2/libgit2#6078

Perhaps we should change methods returning a data_buffer to return a
std::string instead?

This change is slightly backward incompatible. libgit2 1.4.0 made a
chagne to the `git_buf` structure and deprecated a bunch of associated
functions, to the effect that `git_buf` is no longer modifiable by
users. It is expected that `git_buf` should only be set by libgit2
itself as a return from various functions.

So this change to the `data_buffer` class removes all modifier methods.
A data_buffer is returned where libgit2 returns a `git_buf`, but we no
longer allow the caller to modify the buffer data or grow the buffer.

related: libgit2/libgit2#6078

Perhaps we should change methods returning a `data_buffer` to return a
`std::string` instead?
@craigds craigds requested a review from olsen232 March 2, 2022 01:34
@craigds craigds changed the title Use libgit2 1.4.x Require libgit2 1.4.0+. Remove data_buffer methods Mar 2, 2022
Copy link

@olsen232 olsen232 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I'd say, deprecating/removing those functions is unavoidable and in line with the deprecations that libgit2 has made. Switching the type from data_buffer to std::string seems unnecessarily disruptive to clients - I wouldn't do it unless you want to release a new totally incompatible version where you have tidied up the API as you see fit.

@craigds craigds merged commit 3e3e630 into master Mar 2, 2022
@craigds craigds deleted the libgit2-1.4 branch March 2, 2022 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants