chore: replace LibGit2Sharp with native git CLI commands to simplify dependencies#367
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Atom’s breaking-change detection in _atom/RepoUtils to remove the LibGit2Sharp dependency and instead use git CLI calls via IProcessRunner, while also making the detection flow asynchronous and cancellable.
Changes:
- Replace
LibGit2Sharprepository operations (commit/tag/diff) withgitCLI invocations throughProcessRunner. - Update breaking-change detection APIs to
async Taskand threadCancellationTokenthrough the call chain. - Add a lightweight
git diffoutput parser (ParseChanges) and simplify theChangemodel to store raw added/deleted lines as strings.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
_atom/RepoUtils/ICheckPrForBreakingChanges.cs |
Switches release/tag/commit discovery to git CLI and updates call sites to async/cancellable flow. |
_atom/RepoUtils/IApiSurfaceHelper.cs |
Replaces LibGit2Sharp diffing with git diff + custom parsing; updates breaking-change logic to async and string-based line tracking. |
_atom/_usings.cs |
Removes LibGit2Sharp global using and related aliases. |
_atom/_atom.csproj |
Removes the LibGit2Sharp package reference to simplify dependencies. |
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the breaking change detection logic to remove the dependency on
LibGit2Sharpand instead use thegitcommand-line tool via a process runner. The changes streamline repository interactions, improve compatibility, and simplify the codebase by removing direct library usage. Additionally, the pull request updates method signatures to be asynchronous and adjusts related logic accordingly.Repository interaction refactor:
All usages of
LibGit2Sharpfor repository operations (e.g., commit lookup, diff, tag listing) have been replaced with calls to thegitCLI viaProcessRunner, eliminating the direct dependency onLibGit2Sharp. (_atom/RepoUtils/IApiSurfaceHelper.cs,_atom/RepoUtils/ICheckPrForBreakingChanges.cs,_atom/_atom.csproj,_atom/_usings.cs) [1] [2] [3] [4] [5] [6] [7]The
IdentifyBreakingChangesandFindLatestReleaseInfomethods have been updated to be asynchronous (async Task) and now accept aCancellationToken. (_atom/RepoUtils/IApiSurfaceHelper.cs,_atom/RepoUtils/ICheckPrForBreakingChanges.cs) [1] [2] [3] [4]Diff parsing and breaking change detection:
A new
ParseChangeshelper method was added to parse the output ofgit diffand extract added and deleted lines, replacing the previous use ofLibGit2Sharp.Patch. (_atom/RepoUtils/IApiSurfaceHelper.cs)The
Changerecord was updated to useList<string>forAddedLinesandDeletedLinesinstead ofList<Line>, simplifying the data model. (_atom/RepoUtils/IApiSurfaceHelper.cs)Minor improvements:
Logging and suspicious change detection logic were updated to work with the new data structures and asynchronous flow. (
_atom/RepoUtils/IApiSurfaceHelper.cs)The
LibGit2Sharppackage reference and related usings/aliases were removed from the project. (_atom/_atom.csproj,_atom/_usings.cs) [1] [2]