Improvements to filesystem abstractions (part 3)#4498
Merged
arturcic merged 2 commits intoGitTools:mainfrom Apr 16, 2025
Merged
Improvements to filesystem abstractions (part 3)#4498arturcic merged 2 commits intoGitTools:mainfrom
arturcic merged 2 commits intoGitTools:mainfrom
Conversation
Replaces `PathHelper` and `DirectoryHelper` with a centralized `FileSystemHelper` for consistent file system operations. Removes redundant helper implementations and updates all references within the codebase to adopt the new utility. This change improves maintainability and leverages `System.IO.Abstractions` for better testability.
Contributor
There was a problem hiding this comment.
Copilot reviewed 75 out of 76 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- new-cli/GitVersion.Common/GitVersion.Common.csproj: Language not supported
Comments suppressed due to low confidence (1)
src/GitVersion.App.Tests/ExecCmdLineArgumentTest.cs:55
- [nitpick] Verify that using GetTempPathLegacy is intentional; if legacy behavior is not required, standardizing on FileSystemHelper.Path.GetTempPath may improve consistency.
var workingDirectory = FileSystemHelper.Path.GetTempPathLegacy();
src/GitVersion.App/FileSystemGlobbing/DirectoryInfoGlobbingWrapper.cs
Outdated
Show resolved
Hide resolved
49230d8 to
3974f77
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors filesystem operations to use a unified FileSystemHelper for better maintainability and improved test infrastructure while also updating dependency management and service configuration.
- Replaces all usages of PathHelper and DirectoryHelper with FileSystemHelper calls.
- Refactors service configuration to use GitVersionAppModule for dependency injection.
- Updates various test files to align with the new filesystem abstraction patterns.
Reviewed Changes
Copilot reviewed 75 out of 76 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/GitVersion.App/GitVersionExecutor.cs | Uses FileSystemHelper for mutex naming and error messages replacing PathHelper calls. |
| src/GitVersion.App/GitVersionAppModule.cs | Adds necessary import for GitVersion.FileSystemGlobbing. |
| src/GitVersion.App/FileSystemGlobbing/MatcherExtensions.cs | Implements globbing extensions using IFileSystem with modern syntax. |
| src/GitVersion.App/FileSystemGlobbing/IGlobbingResolver.cs | Updates namespace to GitVersion.FileSystemGlobbing. |
| src/GitVersion.App/FileSystemGlobbing/GlobbingResolver.cs | Uses new constructor syntax with IFileSystem and integrates with FileSystemHelper usage. |
| src/GitVersion.App/FileSystemGlobbing/FileSystemInfoGlobbingWrapper.cs | Wraps IFileSystemInfo to support file system globbing. |
| src/GitVersion.App/FileSystemGlobbing/FileInfoGlobbingWrapper.cs | Wraps IFileInfo correctly with FileSystemHelper integration. |
| src/GitVersion.App/FileSystemGlobbing/DirectoryInfoGlobbingWrapper.cs | Implements directory info abstraction using IFileSystem with a minor potential inconsistency. |
| src/GitVersion.App/FileAppender.cs | Replaces PathHelper with FileSystemHelper for log file operations. |
| src/GitVersion.App/ArgumentParserExtensions.cs | Consistently utilizes FileSystemHelper for path operations. |
| src/GitVersion.App/ArgumentParser.cs | Updates configuration file and argument parsing to use FileSystemHelper. |
| Test Files (e.g., UpdateWixVersionFileTests.cs, TagCheckoutInBuildAgentTests.cs, PullRequestInBuildAgentTest.cs, etc.) | Replace legacy helper calls with FileSystemHelper to ensure consistent filesystem access. |
| src/GitVersion.App.Tests/Helpers/GitVersionHelper.cs | Updates log file operations and current directory retrieval using FileSystemHelper. |
| src/GitVersion.App.Tests/ExecCmdLineArgumentTest.cs | Updates temporary path retrieval to use the new FileSystemHelper API. |
| src/GitVersion.App.Tests/ArgumentParserTests.cs | Ensures test assertions reference FileSystemHelper for consistent filename and path handling. |
| src/GitVersion.App.Tests/ArgumentParserOnBuildServerTests.cs | Updates service registration to use GitVersionAppModule. |
Files not reviewed (1)
- new-cli/GitVersion.Common/GitVersion.Common.csproj: Language not supported
src/GitVersion.App/FileSystemGlobbing/DirectoryInfoGlobbingWrapper.cs
Outdated
Show resolved
Hide resolved
3974f77 to
9720330
Compare
Reorganized globbing-related logic into the FileSystemGlobbing namespace. Introduced IFileSystem integration in GlobbingResolver and new wrapper classes for directory and file handling. Simplified service configuration using GitVersionAppModule.
9720330 to
ad6f152
Compare
Contributor
|
Thank you @arturcic for your contribution! |
Contributor
|
🎉 This issue has been resolved in version 6.3.0 🎉 Your GitReleaseManager bot 📦🚀 |
This was referenced Jul 25, 2025
This was referenced Aug 1, 2025
This was referenced Aug 26, 2025
This was referenced Oct 1, 2025
This was referenced Oct 30, 2025
This was referenced Nov 10, 2025
This was referenced Dec 1, 2025
This was referenced Dec 16, 2025
This was referenced Feb 4, 2026
Closed
This was referenced Feb 16, 2026
Open
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 includes several changes to improve the test infrastructure and refactor the code for better maintainability. The most important changes involve adding new dependencies, refactoring the service configuration, and replacing various helper methods with a unified
FileSystemHelperclass.Dependency Management:
System.IO.Abstractionspackage reference inGitVersion.Common.csprojto facilitate file system abstractions.Refactoring Service Configuration:
SetUpmethods inArgumentParserOnBuildServerTestsandArgumentParserTeststo useGitVersionAppModulefor service configuration. [1] [2]File System Helper Integration:
PathHelperandDirectoryHelpermethods withFileSystemHelpermethods across multiple test files for consistency and improved readability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Code Cleanup:
PathHelperandDirectoryHelpermethods and replaced them withFileSystemHelperin various test assertions and setups. [1] [2] [3] [4] [5]Additional Imports:
GitVersion.ExtensionsandGitVersion.FileSystemGlobbingin relevant files to support the new changes. [1] [2] [3]