Skip to content

Manage Runtime Automatically - #11

Merged
ibrahimcetin merged 2 commits into
mainfrom
auto-runtime-management
Nov 28, 2025
Merged

Manage Runtime Automatically#11
ibrahimcetin merged 2 commits into
mainfrom
auto-runtime-management

Conversation

@ibrahimcetin

Copy link
Copy Markdown
Owner

This PR adds automatic runtime management by adding initialization and shutdown methods to public static entrypoints.

The developers don't need to call runtime init, shutdown manually from now on.

- Added runtime initialization and shutdown logic in ConfigCollection methods to ensure proper management of the SwiftGitXRuntime.
- Updated Repository initialization and cloning methods to include runtime management, ensuring the runtime is initialized before operations and shut down afterward.
- Removed runtime initialization from the SwiftGitXTest class constructor and deinitializer, as it is no longer necessary.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements automatic runtime management for the SwiftGitX library by embedding SwiftGitXRuntime.initialize() and shutdown() calls at public entry points, eliminating the need for developers to manually manage the libgit2 runtime lifecycle.

Key Changes:

  • Removed manual runtime initialization/shutdown from test infrastructure
  • Added automatic initialization to all Repository creation paths (init, open, create, clone)
  • Implemented conditional runtime management for ConfigCollection when accessing global config without a repository context

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
Tests/SwiftGitXTests/SwiftGitXTests.swift Removed manual init/shutdown calls from test base class
Sources/SwiftGitX/Repository/Repository.swift Added runtime initialization to public initializer and static factory methods (open, create) with shutdown on error paths
Sources/SwiftGitX/Repository/Repository+clone.swift Added runtime initialization to clone methods with shutdown on error paths
Sources/SwiftGitX/Collections/ConfigCollection.swift Added conditional runtime management for global config operations; fixed missing return statement in configPointer()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/SwiftGitX/Repository/Repository.swift
Comment thread Sources/SwiftGitX/Repository/Repository.swift
Comment thread Sources/SwiftGitX/Collections/ConfigCollection.swift
Comment thread Sources/SwiftGitX/Collections/ConfigCollection.swift
Comment thread Sources/SwiftGitX/Repository/Repository.swift
Comment thread Sources/SwiftGitX/Repository/Repository+clone.swift
Comment thread Sources/SwiftGitX/Repository/Repository+clone.swift
Comment thread Sources/SwiftGitX/Collections/ConfigCollection.swift
@ibrahimcetin
ibrahimcetin merged commit 1d2e097 into main Nov 28, 2025
1 check passed
@ibrahimcetin
ibrahimcetin deleted the auto-runtime-management branch November 28, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants