Files
helder/Sources/HelderServices/Git/GitServicing.swift
T

21 lines
867 B
Swift

import Foundation
import HelderCore
public enum GitError: Error, Equatable {
/// A git command exited non-zero; `stderr` is trimmed.
case commandFailed(arguments: [String], exitCode: Int32, stderr: String)
}
public protocol GitServicing: Sendable {
/// The working state, or nil when the project is not a git repository.
func load() async throws -> GitSnapshot?
/// Stages modifications, additions and deletions of the paths.
func stage(_ paths: [String]) async throws
func unstage(_ paths: [String]) async throws
func commit(message: String) async throws
/// Never throws: a failed push is a toast, not an error.
func push() async -> PushResult
/// Reverts each path to HEAD; a file HEAD does not have is unstaged and deleted, and a staged rename gets its source back.
func discard(_ paths: [String]) async throws
}