Skip to content

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

Closed

Description

@jeremyjh

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.

Activity

  1. twaritwaikar commented on Dec 24, 2020

    @twaritwaikar
    Contributor

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

  2. Xrayez commented on Jul 10, 2021

    @Xrayez

    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.

  3. twaritwaikar commented on Jan 14, 2022

    @twaritwaikar
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions