Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Require libgit2 1.4.0+. Remove data_buffer methods - #1

Merged
craigds merged 1 commit into
masterfrom
libgit2-1.4
Mar 2, 2022
Merged

Require libgit2 1.4.0+. Remove data_buffer methods#1
craigds merged 1 commit into
masterfrom
libgit2-1.4

Conversation

@craigds

@craigds craigds commented Mar 1, 2022

Copy link
Copy Markdown
Member

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

@olsen232 olsen232 left a comment

Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants