godot-git-plugin
godot-git-plugin copied to clipboard
Plugin requires that .godot file be at the top level of the git repository
I tried to set up godot-git-plugin for a project that already has a git history but, no matter what I do, it refuses to recognize what the git
command-line tools and git gui
do... that ../.git
exists and that ..
is a valid git repository.
(For example, if I click "Initialize" and then exit Godot and delete ./.git
to try to get it to recognize ../.git
.)
That makes it useless to me as I don't want to create a new repository inside my existing one and transplant my commit history to it.
The plugin is currently looking for a git repo in the project root directly. There likely needs to be some mitigation in case the current dir is not a git repo
looking for a git repo in the project root directly.
I understand what you're saying, but that terminology is a bit ambiguous because "project root" can mean a lot of things.
In my case, "project root" means the parent folder containing subfolders for the godot project, supplementary content-creation helpers written in Python using PyQt, etc.
There likely needs to be some mitigation in case the current dir is not a git repo
Does libgit2 not have some way to invoke the "walk up the chain of ancestors looking for a repo root" behaviour that Git itself uses? It feels like the most intuitive solution would just be to mimic what happens if I invoke git gui
or some other GUI commit tool in a subfolder of the git repository.
It really should either walk up the tree, or provide a field in the Initialize window to specify the repo root folder.
It's pretty common practice with version control in game dev to have a folder where you're keeping all your original art assets (stuff like psds and ma, blend, ztl or 3ds files) and a folder where the actual game content lives (i.e. C:\My Project\My Art Assets and C:\My Project\My Godot Project), and all of that in the same repo.
libgit2 has an auto-discovery function that automatically walks up the directory and tries to find a Git repository. But I am more inclined to go for the explicit project setting which would be basically a path to the actual Git repository of a Godot project, and then use that directly.
However, this makes it an issue that is solved in the main Godot repo, not here since the plugin is provided with the project path through the editor. I am currently in the middle of getting the v2.0 of the VCS API merged into Godot and after that, I plan to add this feature into the editor. But if anyone else wants to try that before, they are very welcome.
In a situation like that, where auto-discovery is possible but not guaranteed to be perfect, the best choice would be to use a combination of the two approaches.
Something like using the auto-discovery to pre-fill the field, so it Just Works™ in the common case, auto-discovery oopses are visible to the user, and it can be overridden for edge cases.
The main thing that comes to mind as still to be pinned down in that design is how and when to react to discovering that the on-disk layout has changed unexpectedly. Pure autodiscovery would just transparently adapt but using it for auto-fill needs to account for that case explicitly.
Also discussed as part of https://github.com/godotengine/godot-git-plugin/issues/40
The top level of my project contains folders build, src, game (this folder has the .godot file).
This unfortunately means the plug-in doesn't work for me 😕
I think this is an absolute must. Our game live in a monorepo, so it cannot have its project file at the top level
Update: This is being fixed in 4.0 through this PR - https://github.com/godotengine/godot/pull/62157
You may also view a demo of this working in this YT demo video - https://youtu.be/blVtgs4g_GU?t=50 (it's the VCS Project Path
setting shown at the timestamp)
Seems to be working nicely with 4.0b9 and plugin 3.0 — but the plugin creates a redundant .git
on the first load, which needs to be deleted for things to work correctly. Might need to add that autodetection step that was discussed above as suggested by @ssokolow.
BTW easiest way to test is with the plugin repo itself, opening the demo
in godot 😸
Does it still create the redundant .git
folder if you set the VCS Project Path
in the Version Control > Version Control Settings
to a parent directory?
That is an important thing to know, but if it doesn't, I'd say the bug has just shifted from "this functionality doesn't exist" to "godot-git-plugin is ready to trip users up if they miss that note in the instructions".
Does it still create the redundant
.git
folder if you set theVCS Project Path
in theVersion Control > Version Control Settings
to a parent directory?
No. The problem is the workflow goes like this:
- Create or clone project
- Close editor
- Install plugin in
addons
- Load project in editor
- **Extra
.git
gets created here, along with.gitignore
and.gitattributes
- **Extra
- Configure plugin and set correct path
On future loads the folder/files won't be created anymore, but you still need to go delete them once after setup.
Also noticed another possible trap. The path is saved in project.godot
as an absolute path, and project.godot
is obviously committed to git. Most likely when another contributor checks it out, the path will be wrong. Maybe we should save it as relative when that's possible. (Again, we can use the demo as a test case for this.)
@lalomartins I am testing the second problem you mentioned. It looks like Godot will always store an absolute path if you use the file dialog to specify the project path. If the path is different from the directory where Godot is running, there doesn't seem to be an easy way to strip the project path from what the user entered using the file dialog.
The easiest and by far, the thing that makes sense would be to remove the project path setting entirely and let the plugin decide where it needs to be set up i.e. how Git CLI works.
Basically - if Godot is running in a directory that is within a higher-level repo then use it, else, use the current directory.
Seems pretty easy to do. Will try a PoC
That might be for the better. Having the path in settings is kind of redundant with how git works tbh. If someone tries to set a path that isn't an ancestor of the (godot) project root it will just blow up in their face.
I have put some screenshots of this working here - https://github.com/godotengine/godot/pull/70353
@lalomartins I think adding repo discovery might solve the problems you described above. Would it be possible for you to confirm if it is working for you as expected?
Sorry for the delay, little detour learning to build my own godot 😹
Yes, it works for me. Some remote-related features seem to freeze the editor, I'll keep an eye in the next few days if I can reproduce it reliably.
I updated my wiki fork with the new screenshots. Still need to update the settings screenshot once https://github.com/godotengine/godot/pull/70353 is merged.