geany-plugins
geany-plugins copied to clipboard
git-changebar: Add support for libgit2 1.4
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.
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 and this 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.
Reverted for now, there's a version issue…
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.
Thank you!