goostengine / goost

A general-purpose, extensible and customizable C++ extension for Godot Engine.
https://goostengine.github.io/
MIT License
481 stars 18 forks source link

Initial work for updated Git plugin API #190

Closed Xrayez closed 2 years ago

Xrayez commented 2 years ago

Just restoring current functionality. Push/pull may be implemented later.

image

Code updates adapted from godotengine/godot-git-plugin#84. Thanks @ChronicallySerious for ensuring that the API is possible to use via C++ modules (needed for Goost).

twaritwaikar commented 2 years ago

Great to see it's working!

One thing that I want to point out is that I saw that you left out the smart ptr wrappers over libgit2 from the headers. I hope you are aware that this will make you leak memory whenever any libgit2 function fails. Just an FYI.

Xrayez commented 2 years ago

One thing that I want to point out is that I saw that you left out the smart ptr wrappers over libgit2 from the headers.

I'm not sure whether it was there in the first place. But yeah, I'll have to take a closer look.

twaritwaikar commented 2 years ago

Yeah, you can look at these specifically https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_api.h#L88

You would also need the Capture template from the same file if you shift to the smart ptrs. This template will ensure that the functions that take in double ptrs handle the internal object destruction properly in case of any failure.

It certainly looks weird but it streamlines working with libgit2 in C++ if you don't want to depend on using goto's to do cleanup.

Xrayez commented 2 years ago

Turns out I switched to a wrong branch of godot-git-plugin. 🤦

Yeah, I see it now. 😃

Xrayez commented 2 years ago

Unfortunately, I haven't got enough motivation to work on this (#191), but the "Stage All" → "Commit" seems to work as before with new API. Consider this feature to be regressed in relation to 2.0 version, if someone would like to work on this, you can do so by looking up the master branch of godotengine/godot-git-plugin.