gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Failed to set base branch

Open anna-sunberg opened this issue 1 year ago • 5 comments

I choose a branch from a list and get "Failed to set base branch" error

Also occasionally see "Timed out while reloading virtual branches" when scrolling the list, however the list does seem to show correct branches

anna-sunberg avatar Feb 15 '24 09:02 anna-sunberg

Hey @anna-sunberg - i am sorry about this, we should do better, especially during the first time setup. Does the repo have a remote set? It might be interesting to take a look in the app logs (https://docs.gitbutler.com/development/debugging#logs) for something potentially interesting to debug this. (btw, also feel free to ping me on discord if thats convenient for you, i can help debug there)

krlvi avatar Feb 18 '24 21:02 krlvi

Same issue for me:

2024-07-11T21:11:03.901843Z  INFO set_base_branch: crates/gitbutler-tauri/src/virtual_branches.rs:124: new project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin")
2024-07-11T21:11:03.902232Z ERROR set_base_branch: crates/gitbutler-project/src/controller.rs:157: failed to create "/Users/me/Projects/repo/subrepo/.git/gitbutler" on project get project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 error=Os { code: 20, kind: NotADirectory, message: "Not a directory" } project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin")
2024-07-11T21:11:03.903454Z  INFO set_base_branch:create_snapshot: crates/gitbutler-oplog/src/oplog.rs:289: new project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin") self=Project { id: e3ad8921-06dd-4f55-b39f-8c24d12818d4, title: "subrepo", description: None, path: "/Users/me/Projects/repo/subrepo", preferred_key: SystemExecutable, ok_with_force_push: true, api: None, gitbutler_data_last_fetch: None, gitbutler_code_push_state: None, project_data_last_fetch: None, omit_certificate_check: None, snapshot_lines_threshold: None, ignore_project_semaphore: false }
2024-07-11T21:11:03.904832Z ERROR set_base_branch:create_snapshot: crates/gitbutler-oplog/src/oplog.rs:289: error=Not a directory (os error 20) project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin") self=Project { id: e3ad8921-06dd-4f55-b39f-8c24d12818d4, title: "subrepo", description: None, path: "/Users/me/Projects/repo/subrepo", preferred_key: SystemExecutable, ok_with_force_push: true, api: None, gitbutler_data_last_fetch: None, gitbutler_code_push_state: None, project_data_last_fetch: None, omit_certificate_check: None, snapshot_lines_threshold: None, ignore_project_semaphore: false }
2024-07-11T21:11:03.904861Z  INFO set_base_branch:create_snapshot: crates/gitbutler-oplog/src/oplog.rs:289: close time.busy=1.39ms time.idle=19.6µs project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin") self=Project { id: e3ad8921-06dd-4f55-b39f-8c24d12818d4, title: "subrepo", description: None, path: "/Users/me/Projects/repo/subrepo", preferred_key: SystemExecutable, ok_with_force_push: true, api: None, gitbutler_data_last_fetch: None, gitbutler_code_push_state: None, project_data_last_fetch: None, omit_certificate_check: None, snapshot_lines_threshold: None, ignore_project_semaphore: false }
2024-07-11T21:11:03.907572Z ERROR set_base_branch: crates/gitbutler-tauri/src/virtual_branches.rs:124: error=Error(Not a directory (os error 20)) project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin")
2024-07-11T21:11:03.907600Z  INFO set_base_branch: crates/gitbutler-tauri/src/virtual_branches.rs:124: close time.busy=5.69ms time.idle=69.9µs project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 branch="origin/develop" push_remote=Some("origin")
2024-07-11T21:11:04.009880Z  INFO get_base_branch_data: crates/gitbutler-tauri/src/virtual_branches.rs:106: new project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4
2024-07-11T21:11:04.010272Z ERROR get_base_branch_data: crates/gitbutler-project/src/controller.rs:157: failed to create "/Users/me/Projects/repo/subrepo/.git/gitbutler" on project get project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 error=Os { code: 20, kind: NotADirectory, message: "Not a directory" } project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4
2024-07-11T21:11:04.011704Z  INFO get_base_branch_data: crates/gitbutler-tauri/src/virtual_branches.rs:106: close time.busy=1.78ms time.idle=48.2µs project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4
2024-07-11T21:11:04.013134Z  INFO git_remote_branches: crates/gitbutler-tauri/src/commands.rs:11: new project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4
2024-07-11T21:11:04.013374Z ERROR git_remote_branches: crates/gitbutler-project/src/controller.rs:157: failed to create "/Users/me/Projects/repo/subrepo/.git/gitbutler" on project get project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4 error=Os { code: 20, kind: NotADirectory, message: "Not a directory" } project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4
2024-07-11T21:11:04.030399Z  INFO git_remote_branches: crates/gitbutler-tauri/src/commands.rs:11: close time.busy=17.2ms time.idle=30.5µs project_id=e3ad8921-06dd-4f55-b39f-8c24d12818d4

Remote is set, running git remote get-url origin gives our GitLab repo. subrepo here is a submodule for repo. subrepo is the one I am trying to add.

GitButtler: Version 0.12.9 (20240710.081834) MacOS: 14.5

Unknown-Guy avatar Jul 11 '24 21:07 Unknown-Guy

Most likely submodule issue, /Users/me/Projects/repo/subrepo/.git/ does not exist, it has only .git.

# /Users/me/Projects/repo/subrepo/.git
gitdir: ../.git/modules/subrepo

@anna-sunberg do you have similar setup? Or am I hijacking this issue?

Unknown-Guy avatar Jul 11 '24 21:07 Unknown-Guy

I also got this "Failed to set base branch" error on initial setup but in my case the problem was that I first tried to open a bit of an unconventional repository (a collection of proof-of-concepts where many branches have completely unrelated histories created with the --orphan flag). So my current local branch was one that was not sharing any history with origin/main and I was unable to select origin/main here. I just selected the PoC branch I was on and was able to get past this.

Haprog avatar Jul 30 '24 09:07 Haprog

Thanks for sharing, it seems failing to find a merge-base is one reason this error occurs.

Byron avatar Jul 30 '24 13:07 Byron