Skip to content

Releases: ibrahimcetin/SwiftGitX

0.4.0

01 Dec 10:17

Choose a tag to compare

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

29 Nov 15:38

Choose a tag to compare

What's Changed

Full Changelog: 0.2.0...0.3.0

The Important Changes

  • You don't need to call SwiftGitX.initialize() and SwiftGitX.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

25 Nov 20:44
02af190

Choose a tag to compare

What's Changed

New Contributors

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.tree is now a throwing computed property
  • Cache in a local variable if accessing multiple times

0.1.10

23 Nov 13:12

Choose a tag to compare

What's Changed

  • Refactor the codebase for better organization
  • Remove development dependencies from Package.swift
  • Add CommitOptions to support empty commits by @adamwulf in #3

New Contributors

Full Changelog: 0.1.9...0.1.10

0.1.9

07 Aug 14:40

Choose a tag to compare

Update libgit2 version to 1.9.1

0.1.8

07 Aug 06:45
91a8a13

Choose a tag to compare

Merge pull request #2 from TimArt/main

Fix Swift Package Build

0.1.7

26 Sep 17:54

Choose a tag to compare

Full Changelog: 0.1.6...0.1.7

0.1.6

16 Jul 17:28

Choose a tag to compare

Full Changelog: 0.1.5...0.1.6

0.1.5

13 Jul 12:03

Choose a tag to compare

Fix some memory leaks

0.1.4

13 Jul 06:52

Choose a tag to compare

Full Changelog: 0.1.3...0.1.4