Skip to content

Commit

Permalink
Update SourceControlManager.swift
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Ludwig <[email protected]>
  • Loading branch information
phlpsong and tom-ludwig authored Mar 25, 2024
1 parent b74e49a commit 6c5c539
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions CodeEdit/Features/Git/SourceControlManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@ final class SourceControlManager: ObservableObject {

@Published var isGitRepository: Bool = false

var orderedLocalBranches: [GitBranch] {
var orderedBranches: [GitBranch] = []
if let currentBranch {
orderedBranches.append(currentBranch)
}
let othersBranch = branches
.filter { $0.isLocal && $0.name != currentBranch?.name }
.sorted { $0.name < $1.name }
orderedBranches.append(contentsOf: othersBranch)
return orderedBranches
}
var orderedLocalBranches: [GitBranch] {
var orderedBranches: [GitBranch] = [currentBranch].compactMap { $0 }
let otherBranches = branches.filter { $0.isLocal && $0 != currentBranch }
.sorted { $0.name < $1.name }
orderedBranches.append(contentsOf: otherBranches)
return orderedBranches
}

init(
workspaceURL: URL,
Expand Down

0 comments on commit 6c5c539

Please sign in to comment.