gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

[BUG] Can't open submodules as projects

Open jorge-menjivar opened this issue 1 year ago • 3 comments

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

  1. Clone https://github.com/pop-os/cosmic-epoch.
  2. Init the submodules with git submodule update --init --recursive
  3. 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

jorge-menjivar avatar Oct 11 '24 04:10 jorge-menjivar

Thanks a lot for reporting.

I am on it, a PR should be up momentarily.

Byron avatar Oct 11 '24 05:10 Byron

@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!

jorge-menjivar avatar Oct 13 '24 00:10 jorge-menjivar

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

Byron avatar Oct 13 '24 09:10 Byron

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?

king-11 avatar Apr 02 '25 18:04 king-11

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.

Byron avatar Apr 03 '25 02:04 Byron