Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging Doesn't Stage Files in Git? (MacOS) #54

Closed
jeremyjh opened this issue Dec 23, 2020 · 3 comments
Closed

Staging Doesn't Stage Files in Git? (MacOS) #54

jeremyjh opened this issue Dec 23, 2020 · 3 comments

Comments

@jeremyjh
Copy link

OS: MacOS (10.14.6)
Godot: 3.2.3 (stable)

When I click "Stage Selected" or "Stage All" I am told "Stage contains 1 file" at the bottom, but the file remains Yellow in the staging area in the UI and the git index is not changed when I look at git status. Commit Changes does commit the staged file, but there is no way for me to see what is staged, and what isn't. Shouldn't staging a file stage in the plugin also stage it in the git index so that the plugin interacts with other git tools correctly? Right now it seems like Godot has its own invisible notion of what is staged and what isn't, that is unrelated to the git index status.

@twaritwaikar
Copy link
Contributor

twaritwaikar commented Dec 24, 2020

This is one oversimplification we had to do to make staging and committing possible in code (libgit2 doesn't seem to have the best documentation so a lot of the implementation we did for v1.x was "figured out" with experimentation).

This was also a glaring weakness in our v1.x which has been since fixed and implemented properly in the upcoming v2.0.

(v2.0 is currently on hold till the GDNative C++ API gets updated for Godot 4.0, see godotengine/godot-cpp#449).

@Xrayez
Copy link

Xrayez commented Jul 10, 2021

Yeah, looks like it just maintains a list of files:

void GitAPI::_stage_file(const String p_file_path) {
if (staged_files.find(p_file_path) == -1) {
staged_files.push_back(p_file_path);
}
}
void GitAPI::_unstage_file(const String p_file_path) {
if (staged_files.find(p_file_path) != -1) {
staged_files.erase(p_file_path);
}
}

By the way, this could be considered a bug, because staging implies saving the state of the working tree (if I use the terms correctly). I use git add . quite often without committing, so that git history is not so dirty when I do intermediate changes.

This means that when exiting the editor, you may get disappointed due to the fact that those staged changes were not saved in case you did something stupid just before exiting the editor to revert those dirty changes.

Also, I'm in the process of working on built-in integration of Git in Goost, see goostengine/goost#98, and before merging it likely makes sense to resolve this regardless, but I'm not yet sure what to do, need to learn libgit2 API a bit, or perhaps take a look at v2.0 of this plugin (yet I'm working against the v1.0 version in Godot 3.x, so might not be possible to do). Update: resolved this in e320fe9 (#98), that's still v1.0 of the plugin.

@twaritwaikar
Copy link
Contributor

twaritwaikar commented Jan 14, 2022

The Godot 3.5 beta1 is now live. And along with it, we released a v2.0.0 of this plugin which should fix this issue. Files that are staged in the editor will now appear as staged when checking through git status as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants