``` gcb-plugin.c: In function ‘gcb_git_buf_grow’: gcb-plugin.c:219:12: error: ‘git_buf’ has no member named ‘asize’; did you mean ‘size’? 219 | if (buf->asize == 0) { | ^~~~~ | size gcb-plugin.c: In function ‘buf_zero’: gcb-plugin.c:237:10: error: ‘git_buf’ has no member named ‘asize’; did you mean ‘size’? 237 | buf->asize = 0; | ^~~~~ | size ```
geany-plugins-1.38
We are also seeing this on Arch Linux and it is blocking our upgrade to libgit2 1.4.1. A fix for this would be much appreciated! :)
It appears that `git_buf` has undergone a major rewrite in https://github.com/libgit2/libgit2/pull/6078
The following fixes this for my build, but I admit that I have no clue what I am doing here and this could not be the way to fix this:
``` diff --git i/git-changebar/src/gcb-plugin.c w/git-changebar/src/gcb-plugin.c index f8ce20cd..4488b22f 100644 --- i/git-changebar/src/gcb-plugin.c +++ w/git-changebar/src/gcb-plugin.c @@ -216,7 +216,7 @@ static int gcb_git_buf_grow (git_buf *buf, size_t target_size) { - if (buf->asize == 0) { + if (buf->reserved == 0) { if (target_size == 0) { target_size = buf->size; } @@ -234,7 +234,7 @@ buf_zero (git_buf *buf) if (buf) { buf->ptr = NULL; buf->size = 0; - buf->asize = 0; + buf->reserved = 0; } }
```
It is going to be (literally) years before Debian stable or Ubuntu LTS get to libgit1.4.1 so I presume that the plugin maintainer will still want it to build against earlier libgit versions.
So when somebody makes a PR the code using new API should be `#if`ed based on what version is being built against and I expect configure should enable the right version.
@dvzrv's approach is good. I added the necessary `ifdef`s in #1165.
However, as said in the PR, in the long term more code refactoring will be necessary as the whole `git_buf` object is now meant to be readonly and we use APIs to modify it but those APIs are already deprecated.
Closed #1164 as completed via #1178.
github-comments@lists.geany.org