You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right, I wasn't intending or expecting this change to be quite so troublesome. Indeed, I can imagine that C++ and const correctness would require some changes. I didn't realize that C++ enforced const correctness on extern C but that's little surprise as I'm not a C++ programmer and this is not a C++ library.
In any case, git_commits aren't const. They have an internal state that points into an internal cache, those pointers can change, and they're refcounted which will change. Making this const git_commit ** was a mistake in the first place, which you can see by the unnecessary casts that existed in the examples, etc.
However:
There are a surprising number of places that take a const git_commit *. Which surprises me.
I wasn't intending for this to be a breaking change. (Even if you are using C++.)
I need to have a deeper look at this, but I wanted to provide the rationale behind the change.
Reproduction steps
Compile code that was written against version prior to 1.8.0 such as
https://github.com/horizon-eda/horizon/blob/5300ccd7f9ba81818eb34d9ffc1b8fe80df6c658/src/pool-prj-mgr/pool-mgr/pool_git_box.cpp#L634-L642
Expected behavior
Should compile, the release notes don't include any related breaking changes in that regard.
Actual behavior
Doesn't compile, see https://github.com/horizon-eda/horizon/actions/runs/8589355641/job/23582932883#step:6:559
The offending commit is cf19ddc
For the
git_commit_create
method, I'm not quite sure if this commit actually did the right thing:git_commit_create
should not have to modify the passedgit_commit
objects, so theconst
was in fact correctconst git_commit * const parents[]
is what we need. This also doesn't have the compatibility problemThe current situation would require some annoying version check macros and casts to be compatible with versions prior to 1.8.0 and 1.8.0.
Version of libgit2 (release number or SHA1)
1.8.0
Operating system(s) tested
Linux
The text was updated successfully, but these errors were encountered: