geany-plugins icon indicating copy to clipboard operation
geany-plugins copied to clipboard

git-changebar: Add support for libgit2 1.4

Open b4n opened this issue 2 years ago • 7 comments

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.

b4n avatar Jun 05 '22 21:06 b4n

I can't test either, but looks ok by inspection.

elextr avatar Jun 05 '22 22:06 elextr

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.

eht16 avatar Jun 06 '22 08:06 eht16

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! :)

b4n avatar Jun 06 '22 10:06 b4n

Can using the init function and this instead of assignment init fix the warnings?

elextr avatar Jun 07 '22 01:06 elextr

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.

cwendling avatar Jun 17 '22 11:06 cwendling

Reverted for now, there's a version issue…

cwendling avatar Jun 17 '22 13:06 cwendling

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.

cwendling avatar Jun 17 '22 20:06 cwendling

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 avatar Sep 04 '22 13:09 eht16

@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.

cwendling avatar Sep 06 '22 07:09 cwendling

Alright. @cwendling @b4n if none of you (:D) disagree, I'd remove the WIP flag and merge it soon.

eht16 avatar Sep 10 '22 14:09 eht16

@eht16 go ahead, we (;)) agree.

b4n avatar Sep 13 '22 15:09 b4n

Thank you!

eht16 avatar Sep 13 '22 20:09 eht16