fix(tauri,core): auto-detect default branch when adding a repository#7
Merged
fix(tauri,core): auto-detect default branch when adding a repository#7
Conversation
Previously, default_branch was stored as NULL when a repo was added, falling back to the hardcoded string "main". If the repo used "master" or any other branch name, the engine worker would fail when trying to create a task branch with: "fatal: 'main' is not a commit and a branch '...' cannot be created from it." - Add detect_default_branch() to engine/git.rs: tries `git symbolic-ref --short refs/remotes/origin/HEAD` first (accurate for cloned repos with a remote), falls back to current branch name, then "main" as a last resort - Add get_repo_default_branch Tauri command in repository.rs and register it in lib.rs - Update addRepository() in repositories.ts to call the new command and store the detected branch in the INSERT statement - Remove the duplicate (and less accurate) branch detection that was running in useAddRepository after dbAddRepository Existing repos with NULL/incorrect default_branch can be corrected via the repository settings UI.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, default_branch was stored as NULL when a repo was added, falling back to the hardcoded string "main". If the repo used "master" or any other branch name, the engine worker would fail when trying to create a task branch with: "fatal: 'main' is not a commit and a branch '...' cannot be created from it."
git symbolic-ref --short refs/remotes/origin/HEADfirst (accurate for cloned repos with a remote), falls back to current branch name, then "main" as a last resortExisting repos with NULL/incorrect default_branch can be corrected via the repository settings UI.