[BUG] Can't open submodules as projects
Version
0.13.0
Operating System
Linux
Distribution Method
AppImage (Linux)
Describe the issue
I want to open and work in a submodule in my repo, but I get "Not a directory (os error 20)" when trying to open a submodule as a project. Opening the main project does not cause this issue.
How to reproduce
Using the cosmic-epoch repo as an example
- Clone https://github.com/pop-os/cosmic-epoch.
- Init the submodules with
git submodule update --init --recursive - Open any of the submodules inside the cosmic-epoch project as a submodule. It will throw the error.
Expected behavior
It should be able to open it (i.e. deal with .git files)
Relevant log output
2024-10-11T04:45:57.632111Z ERROR get_project: crates/gitbutler-project/src/controller.rs:161: failed to create "/home/jorge/rust_projects/cosmic-epoch/cosmic-applibrary/.git/gitbutler" on project get project_id=5bcdae24-6a01-4275-90d7-b9b5671a4a42 error=Os { code: 20, kind: NotADirectory, message: "Not a directory" } id=5bcdae24-6a01-4275-90d7-b9b5671a4a42 no_validation=None
2024-10-11T04:45:57.632145Z INFO get_project: crates/gitbutler-tauri/src/projects.rs:32: close time.busy=804µs time.idle=47.3µs id=5bcdae24-6a01-4275-90d7-b9b5671a4a42 no_validation=None
2024-10-11T04:45:57.633198Z ERROR set_project_active: crates/gitbutler-project/src/controller.rs:161: failed to create "/home/jorge/rust_projects/cosmic-epoch/cosmic-applibrary/.git/gitbutler" on project get project_id=5bcdae24-6a01-4275-90d7-b9b5671a4a42 error=Os { code: 20, kind: NotADirectory, message: "Not a directory" } id=5bcdae24-6a01-4275-90d7-b9b5671a4a42
2024-10-11T04:45:57.633231Z ERROR set_project_active:set_project_to_window: crates/gitbutler-tauri/src/window.rs:129: error=Not a directory (os error 20) id=5bcdae24-6a01-4275-90d7-b9b5671a4a42 window="main"
2024-10-11T04:45:57.633242Z INFO set_project_active:set_project_to_window: crates/gitbutler-tauri/src/window.rs:129: close time.busy=19.7µs time.idle=6.48µs id=5bcdae24-6a01-4275-90d7-b9b5671a4a42 window="main"
2024-10-11T04:45:57.633252Z ERROR set_project_active: crates/gitbutler-tauri/src/projects.rs:67: error=Error(Not a directory (os error 20)) id=5bcdae24-6a01-4275-90d7-b9b5671a4a42
2024-10-11T04:45:57.633261Z INFO set_project_active: crates/gitbutler-tauri/src/projects.rs:67: close time.busy=318µs time.idle=9.24µs id=5bcdae24-6a01-4275-90d7-b9b5671a4a42
Thanks a lot for reporting.
I am on it, a PR should be up momentarily.
@Byron Now, when trying to open a submodule on nightly 0.5.794, I get the following:
A git-repository without a `.git` directory cannot currently be added
I am just getting started with gitbutler, so I don't know the whole project state yet. Does this mean that there is no support for submodules at all?
The .git file in the submodule root dir includes the location of the actual git dir, which may be used to find its location:
gitdir: ../.git/modules/my-submodule
Thanks!
GitButler currently makes the incorrect assumption that .git is always a directory. This alone would definitely be fixable, however, there would probably be a whole lot of other issues to root out after that.
I have reopened this issue and changed the expectation along with the labelling to basically turn it into: "let's allow this case".
Hey @Byron is this something that's being actively tracked? Or if there is some way I can contribute to make it happen what would that encompass?
This isn't tracked, but it will work in subsequent increments on the next major release. The goal will be to let GitButler open any valid Git repository. The closest to tracking this is the progress on this PR, which even when merged will need some follow-ups to be incorporated.