Sapling/Sources/SaplingGit/EmbeddedGitProvider.swift

41 lines
1.9 KiB
Swift

import Foundation
import SaplingCore
public final class EmbeddedGitProvider: GitProvider {
public let displayName = "Embedded Git"
public init() {}
public func initRepository(at path: URL) async throws -> GitRepository {
throw GitProviderError.notImplemented("Embedded Git init is reserved for the future iOS provider.")
}
public func clone(remoteURL: URL, to destinationURL: URL) async throws -> GitRepository {
throw GitProviderError.notImplemented("Embedded Git clone is reserved for the future iOS provider.")
}
public func repository(at path: URL) -> any Repository {
EmbeddedRepository(rootURL: path)
}
}
private struct EmbeddedRepository: Repository {
let rootURL: URL
func status() async throws -> [GitFileStatus] { throw unsupported() }
func add(paths: [String]) async throws { throw unsupported() }
func commit(message: String) async throws -> GitCommit { throw unsupported() }
func push(remote: String?, branch: String?) async throws { throw unsupported() }
func pull(remote: String?, branch: String?) async throws { throw unsupported() }
func createBranch(named name: String) async throws -> GitBranch { throw unsupported() }
func switchBranch(named name: String) async throws -> GitBranch { throw unsupported() }
func merge(branch name: String) async throws { throw unsupported() }
func addSubmodule(remoteURL: URL, path: String) async throws -> Subproject { throw unsupported() }
func removeSubmodule(path: String) async throws { throw unsupported() }
func updateSubmodules(initSubmodules: Bool, recursive: Bool) async throws { throw unsupported() }
func syncSubmodules(recursive: Bool) async throws { throw unsupported() }
private func unsupported() -> GitProviderError {
.notImplemented("Embedded Git repository operations are intentionally stubbed for iOS.")
}
}