Releases: ibrahimcetin/SwiftGitX
0.4.0
SwiftGitX on Linux, Android, watchOS and tvOS
- SwiftGitX now works on linux, android, watchOS and tvOS in addition to iOS and macOS.
Improvements
- Conform SwiftGitXError to CustomDebugStringConvertible for better error message
Fixes
- Fix potential memory leak on Signature type
Full Changelog: 0.3.0...0.4.0
0.3.0
What's Changed
- Rename SwiftGitX enum to SwiftGitXRuntime by @ibrahimcetin in #6
- Improve ConfigCollection API with new set(_:to:) method by @ibrahimcetin in #7
- Improve Signature Model with Public Initializer and Better API by @ibrahimcetin in #8
- Migrate Test Suite from XCTest to Swift Testing by @ibrahimcetin in #9
- Swift 6 Support by @ibrahimcetin in #10
- Manage Runtime Automatically by @ibrahimcetin in #11
Full Changelog: 0.2.0...0.3.0
The Important Changes
- You don't need to call
SwiftGitX.initialize()andSwiftGitX.shutdown()methods explicitly anymore, it is managed by the library now. You can remove them from your code safely. - Swift 6 support added
- All tests refactored and migrated to swift-testing
0.2.0
What's Changed
- Redesign Error Handling - Implement Typed Throws by @ibrahimcetin in #4
- Implement lazy loading for Commit.tree property by @ibrahimcetin in #5
New Contributors
- @ibrahimcetin made their first contribution in #4
Full Changelog: 0.1.10...0.2.0
Why Error Handling Redesigned?
The previous approach used individual error types for each component (CommitError, BranchError, RepositoryError, etc.), which created fragmented error handling and provided limited context about what actually went wrong. The new unified approach aligns with libgit2's error reporting and provides much richer error information.
What Changed for Users
Before:
do {
try repository.commit(message: "Initial commit")
} catch let error as CommitError {
// Limited context, multiple error types to handle
} catch let error as RepositoryError {
// Different error type, different properties
}Now:
do {
try repository.commit(message: "Initial commit")
} catch {
// error is always SwiftGitXError with full context
print("Operation: \(error.operation)") // "commit"
print("Code: \(error.code)") // .invalidSpec, .conflict, etc.
print("Category: \(error.category)") // .repository, .object, etc.
print("Message: \(error.message)") // Detailed message from libgit2
// Convenient checks
if error.isConflict { ... }
}Every error now includes:
- Which operation failed (commit, fetch, clone, etc.)
- What went wrong (42 error codes matching libgit2)
- Where it originated (37 categories for subsystems)
- Detailed human-readable message from libgit2
What Changed for Development
New helper functions make internal development significantly easier:
git() wrapper functions:
Before: Manual error checking everywhere
var pointer: OpaquePointer?
let status = git_clone(&pointer, url, path, &options)
guard status >= 0 else { throw ... }
guard let pointer else { throw ... }Now: Automatic error checking and operation tracking
let pointer = try git(operation: .clone) {
var pointer: OpaquePointer?
let status = git_clone(&pointer, url, path, &options)
return (pointer, status)
}SwiftGitXError.check() methods:
try SwiftGitXError.check(status, operation: .fetch)Breaking Changes
Yes, all error types have changed. Update your error handling to use SwiftGitXError instead of individual error types. The new approach provides significantly more context and is easier to work with. Other than that, the API interface is the same as before.
What is the benefit of the lazy loading Commit.tree?
- 50% RAM reduction when loading full commit history (tested on Swift source code repo: 1.8GB → 0.9GB)
- Tree is only fetched when accessed, improving performance for operations that don't need tree data
Breaking Change
Commit.treeis now a throwing computed property- Cache in a local variable if accessing multiple times
0.1.10
0.1.9
Update libgit2 version to 1.9.1
0.1.8
Merge pull request #2 from TimArt/main Fix Swift Package Build
0.1.7
Full Changelog: 0.1.6...0.1.7
0.1.6
Full Changelog: 0.1.5...0.1.6
0.1.5
Fix some memory leaks
0.1.4
Full Changelog: 0.1.3...0.1.4