You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plugin requires that .godot file be at the top level of the git repository #76
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.
Reacted by Twarit Waikar, Sascha Lüdecke, Mitch Coote, Rafael Vidaurre and Lalo Martins
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.
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 the VCS Project Path in the Version 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
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.
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.
@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?
Activity
twaritwaikar commentedon Sep 9, 2021
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
ssokolow commentedon Sep 9, 2021
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.
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 guior some other GUI commit tool in a subfolder of the git repository.DKesserich commentedon Nov 30, 2021
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.
twaritwaikar commentedon Nov 30, 2021
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.
ssokolow commentedon Dec 1, 2021
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.
sluedecke commentedon Aug 6, 2022
Also discussed as part of #40
monkeez commentedon Aug 7, 2022
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 😕
RafaelVidaurre commentedon Aug 24, 2022
I think this is an absolute must. Our game live in a monorepo, so it cannot have its project file at the top level
twaritwaikar commentedon Aug 24, 2022
Update: This is being fixed in 4.0 through this PR - godotengine/godot#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 Pathsetting shown at the timestamp)lalomartins commentedon Dec 20, 2022
Seems to be working nicely with 4.0b9 and plugin 3.0 — but the plugin creates a redundant
.giton 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
demoin godot 😸twaritwaikar commentedon Dec 20, 2022
Does it still create the redundant
.gitfolder if you set theVCS Project Pathin theVersion Control > Version Control Settingsto a parent directory?ssokolow commentedon Dec 20, 2022
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".
lalomartins commentedon Dec 20, 2022
No. The problem is the workflow goes like this:
addons.gitgets created here, along with.gitignoreand.gitattributesOn future loads the folder/files won't be created anymore, but you still need to go delete them once after setup.
lalomartins commentedon Dec 20, 2022
Also noticed another possible trap. The path is saved in
project.godotas an absolute path, andproject.godotis 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.)twaritwaikar commentedon Dec 20, 2022
@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
lalomartins commentedon Dec 20, 2022
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.
twaritwaikar commentedon Dec 20, 2022
I have put some screenshots of this working here - https://github.com/godotengine/godot/pull/70353
twaritwaikar commentedon Dec 20, 2022
@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?
Merge pull request #1 from twaritwaikar/add-repo-discovery
lalomartins commentedon Dec 20, 2022
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 godotengine/godot#70353 is merged.