Normalizes target path in dotnet tool#1554
Merged
arturcic merged 1 commit intoGitTools:mainfrom Apr 2, 2025
Merged
Conversation
Ensures the target path for dotnet tools is properly normalized. - Adds `targetPath` to GitVersion command tasks in CI workflow - Resolves relative paths to absolute paths - Normalizes the directory separator for consistency. This prevents issues caused by inconsistent path formats, especially on different operating systems.
There was a problem hiding this comment.
Pull Request Overview
This PR addresses inconsistent target path formats in dotnet tools by resolving relative paths to absolute ones and normalizing directory separators. Key changes include:
- Updating DotnetTool to resolve and normalize target paths using path.resolve and path.normalize.
- Adjusting tests in dotnet-tool, GitVersion, and GitReleaseManager suites to reflect the new target path handling.
- Updating CI workflow configurations to supply an explicit targetPath.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/common/dotnet-tool.ts | Updated target path resolution and normalization logic. |
| src/tests/tools/gitversion/tool.spec.ts | Removed tests for getRepoDir; test updates focus on execute arguments. |
| src/tests/tools/gitversion/runner.spec.ts | Modified test description to reflect expected output variable change. |
| src/tests/tools/gitreleasemanager/tool.spec.ts | Updated targetDirectory normalization in multiple argument-building tests. |
| src/tests/tools/common/dotnet-tool.spec.ts | Added tests for new getRepoPath behavior including relative and absolute paths. |
| .github/workflows/ci.yml | Included explicit targetPath inputs for gitversion commands. |
Comments suppressed due to low confidence (4)
src/tools/common/dotnet-tool.ts:228
- [nitpick] Using path.normalize may not enforce forward slashes consistently across operating systems; if a uniform forward slash format is intended, consider using path.posix.normalize or an alternative approach to ensure consistency.
return path.normalize(workDir)
src/tests/tools/gitversion/runner.spec.ts:87
- [nitpick] The updated test description should be reviewed to ensure it accurately reflects the intended output; please confirm that changing from 'Major variable' to 'Sha variable' is correct.
it.sequential('should output Sha variable', async () => {
src/tests/tools/gitversion/tool.spec.ts:112
- Removal of getRepoDir tests may reduce coverage for target path normalization behavior; consider reintroducing tests to verify the expected functionality.
describe('getRepoDir', () => { ... removed tests ...
src/tests/tools/gitreleasemanager/tool.spec.ts:79
- The removal of getRepoDir tests decreases test coverage for the new normalized path behavior; adding tests to cover correct path resolution and error handling is recommended.
describe('getRepoDir', () => { ... removed tests ...
Contributor
|
Thank you @arturcic for your contribution! |
Contributor
|
🎉 This issue has been resolved in version v3.2.0 🎉 Your GitReleaseManager bot 📦🚀 |
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.
Ensures the target path for dotnet tools is properly normalized.
targetPathto GitVersion command tasks in CI workflowThis prevents issues caused by inconsistent path formats, especially on different operating systems.