This should fix #1164 , and replaces #1165.
BEWARE: I did NOT test this with libgit2 1.4, that I don't have yet. I might go to the trouble of building it and all, but for now this is a theoretical PR, but if libgit2 1.4 users can verify it it'd be great. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/1178
-- Commit Summary --
* git-changebar: Simplify libgit2 version checks * git-changebar: Add support for libgit2 1.4
-- File Changes --
M git-changebar/src/gcb-plugin.c (88)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/1178.patch https://github.com/geany/geany-plugins/pull/1178.diff
@b4n pushed 1 commit.
5d9f1bc6d010e6b4c6a21af8a39b90922f89a82c git-changebar: Add support for libgit2 1.4
I can't test either, but looks ok by inspection.
Compiled and seems to work fine so far against libgit2 1.4.3.
There were two minor compiler warnings: ``` make[3]: Entering directory '/home/enrico/projects/geany-plugins/git-changebar/src' CC git_changebar_la-gcb-plugin.lo gcb-plugin.c: In function ‘get_blob_contents’: gcb-plugin.c:283:3: warning: missing initializer for field ‘commit_id’ of ‘git_blob_filter_options’ [-Wmissing-field-initializers] 283 | git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT; | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/git2.h:14, from gcb-plugin.c:29: /usr/include/git2/blob.h:141:18: note: ‘commit_id’ declared here 141 | git_oid *commit_id; | ^~~~~~~~~ gcb-plugin.c: In function ‘diff_buf_to_doc’: gcb-plugin.c:744:3: warning: missing initializer for field ‘interhunk_lines’ of ‘git_diff_options’ [-Wmissing-field-initializers] 744 | git_diff_options opts = GIT_DIFF_OPTIONS_INIT; | ^~~~~~~~~~~~~~~~ In file included from /usr/include/git2/apply.h:13, from /usr/include/git2.h:12, from gcb-plugin.c:29: /usr/include/git2/diff.h:422:21: note: ‘interhunk_lines’ declared here 422 | uint32_t interhunk_lines; | ^~~~~~~~~~~~~~~ CCLD git-changebar.la ```
I'm going to use and test it for the next few days but I don't expect anything bad.
For the warnings there's not much I can do about it and it shouldn't be much of a problem anyway -- and the OPTIONS one is nothing new.
Thanks for testing this! :)
Can using the init [function](https://libgit2.org/libgit2/#HEAD/group/blob/git_blob_filter_options_init) and [this](https://libgit2.org/libgit2/#HEAD/group/diff/git_diff_options_init) instead of assignment init fix the warnings?
@b4n pushed 1 commit.
43e4bc4acbac7067ce181a31135e3895417261e9 git-changebar: Avoid harmless warnings
Can using the init [function](https://libgit2.org/libgit2/#HEAD/group/blob/git_blob_filter_options_init) and [this](https://libgit2.org/libgit2/#HEAD/group/diff/git_diff_options_init) instead of assignment init fix the warnings?
Good point, now done. It's sad to have to make "useless" calls like so, but it's worth it here.
@b4n pushed 0 commits.
Reverted for now, there's a version issue…
@b4n pushed 1 commit.
c8d227e50dffc3ed97b83e8b6159da455e429a23 git-changebar: Avoid harmless warnings
@b4n pushed 1 commit.
b6e5b174e38799f397dff4d61614a8a806bb2338 git-changebar: Avoid harmless warnings
Reverted for now, there's a version issue…
Yeah… so libgit2 renamed `git_diff_options_init()` to `git_diff_init_options()` in 0.21, and back in 0.99.. All is well.
I'm using this PR since June and it works great!
I'd like to merge this (and maybe squash the last commit before).
@eht16 sure, if that works as it should I'm all for it :)
But for squashing the last commit I'm not sure, it also touches code that is unrelated to the change, but required a similar fix to avoid warnings… so I'd probably rather keep it separate, more as a "alter style to avoid warnings" change rather than an "oops" one.
Alright. @cwendling @b4n if none of you (:D) disagree, I'd remove the WIP flag and merge it soon.
@eht16 go ahead, we (;)) agree.
Merged #1178 into master.
Thank you!
github-comments@lists.geany.org