Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(git): use branch --show-current to get current branch #1597

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CodeEdit/Features/Git/Client/GitClient+Branches.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension GitClient {

/// Get current branch
func getCurrentBranch() async throws -> GitBranch? {
let branchName = try await run("rev-parse --abbrev-ref HEAD").trimmingCharacters(in: .whitespacesAndNewlines)
let branchName = try await run("branch --show-current").trimmingCharacters(in: .whitespacesAndNewlines)
let components = try await run(
"for-each-ref --format=\"%(refname)|%(upstream:short)\" refs/heads/\(branchName)"
)
Expand Down