Skip to content
Merged
2 changes: 2 additions & 0 deletions macos/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@
"Notifications" = "Notifications";
"Clear All" = "Clear All";
"No notifications" = "No notifications";
"Log: %@" = "Log: %@";
"Console" = "Console";
2 changes: 2 additions & 0 deletions macos/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1211,3 +1211,5 @@
"Notifications" = "通知";
"Clear All" = "全部清除";
"No notifications" = "暂无通知";
"Log: %@" = "日志:%@";
"Console" = "控制台";
25 changes: 25 additions & 0 deletions macos/Sources/Lithe/Core/Rust/RustCoreBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -770,13 +770,38 @@ struct RustCoreBridge: Sendable {
}

struct GitCommandPayload: Decodable, Sendable {
struct Invocation: Decodable, Sendable {
let arguments: [String]
let stdout: String
let stderr: String
let exitCode: Int32
}

struct OperationError: Decodable, Sendable {
let code: String
let message: String
let details: String?

var userMessage: String {
if let details, !details.isEmpty {
return message + ": " + details
}
return message
}
}

struct StashRestore: Decodable, Sendable {
let stashReference: String
let conflictedPaths: [String]
}

let arguments: [String]?
let output: String
let stdout: String?
let stderr: String?
let exitCode: Int32
let invocations: [Invocation]?
let operationError: OperationError?
let stashRestore: StashRestore?
}

Expand Down
20 changes: 18 additions & 2 deletions macos/Sources/Lithe/Core/Rust/RustGitOperations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ struct RustGitOperations: GitOperations, Sendable {

private func makeProcessResult(_ response: RustCoreBridge.GitCommandPayload) -> GitProcessResult {
GitProcessResult(
output: response.output,
arguments: response.arguments ?? [],
output: response.operationError?.userMessage ?? response.output,
standardOutput: response.stdout,
standardError: response.stderr,
exitCode: response.exitCode,
invocations: response.invocations?.map {
GitProcessInvocation(
arguments: $0.arguments,
standardOutput: $0.stdout,
standardError: $0.stderr,
exitCode: $0.exitCode
)
} ?? [],
operationErrorMessage: response.operationError?.userMessage,
stashRestoreConflict: response.stashRestore.map {
GitStashRestoreConflict(
stashReference: $0.stashReference,
Expand All @@ -35,7 +47,11 @@ struct RustGitOperations: GitOperations, Sendable {
case .success(let response):
return makeProcessResult(response)
case .failure(let error):
return GitProcessResult(output: error.userMessage, exitCode: 1)
return GitProcessResult(
output: error.userMessage,
standardError: error.userMessage,
exitCode: 1
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ extension AppModel {
var isPerformingStashOperation: Bool { gitFeatureIfActive?.isPerformingStashOperation ?? false }
var isPerformingShelfOperation: Bool { gitFeatureIfActive?.isPerformingShelfOperation ?? false }
var gitOperationState: GitOperationState? { gitFeatureIfActive?.gitOperationState }
var gitConsoleEntries: [GitConsoleEntry] { gitFeatureIfActive?.gitConsoleEntries ?? [] }
var isResolvingGitOperation: Bool { gitFeatureIfActive?.isResolvingGitOperation ?? false }
func clearGitConsole() { gitFeatureIfActive?.clearGitConsole() }
func loadGitConsoleIfNeeded() async { await gitFeatureIfActive?.loadGitConsoleIfNeeded() }
var gitRepositoryRoot: URL? { gitFeatureIfActive?.gitRepositoryRoot }
var currentBranch: String { gitFeatureIfActive?.currentBranch ?? "No Git" }
var selectedChange: GitChange? {
Expand Down
Loading
Loading