Skip to content

Commit 98a155c

Browse files
committed
cleanup
1 parent 6cdc920 commit 98a155c

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

src/GitVersion.App/ArgumentParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private static void ValidateConfigurationFile(Arguments arguments)
108108
}
109109
else
110110
{
111-
var configFilePath = Path.GetFullPath(Path.Combine(arguments.TargetPath!, arguments.ConfigurationFile));
111+
var configFilePath = Path.GetFullPath(PathHelper.Combine(arguments.TargetPath, arguments.ConfigurationFile));
112112
if (!File.Exists(configFilePath)) throw new WarningException($"Could not find config file at '{configFilePath}'");
113113
arguments.ConfigurationFile = configFilePath;
114114
}

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class ConfigurationProviderTests : TestBase
2020
[SetUp]
2121
public void Setup()
2222
{
23-
this.repoPath = Path.Combine(PathHelper.GetTempPath(), "MyGitRepo");
23+
this.repoPath = PathHelper.Combine(PathHelper.GetTempPath(), "MyGitRepo");
2424
var options = Options.Create(new GitVersionOptions { WorkingDirectory = repoPath });
2525
var sp = ConfigureServices(services => services.AddSingleton(options));
2626
this.configurationProvider = (ConfigurationProvider)sp.GetRequiredService<IConfigurationProvider>();

src/GitVersion.Core/Extensions/ConfigurationExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Text.RegularExpressions;
22
using GitVersion.Extensions;
33
using GitVersion.Git;
4+
using GitVersion.Helpers;
45
using GitVersion.VersionCalculation;
56

67
namespace GitVersion.Configuration;
@@ -117,7 +118,7 @@ public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(thi
117118
string? startingDir = path;
118119
while (startingDir is not null)
119120
{
120-
var dirOrFilePath = Path.Combine(startingDir, ".git");
121+
var dirOrFilePath = PathHelper.Combine(startingDir, ".git");
121122
if (Directory.Exists(dirOrFilePath))
122123
{
123124
return (dirOrFilePath, Path.GetDirectoryName(dirOrFilePath)!);
@@ -128,7 +129,7 @@ public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(thi
128129
string? relativeGitDirPath = ReadGitDirFromFile(dirOrFilePath);
129130
if (!string.IsNullOrWhiteSpace(relativeGitDirPath))
130131
{
131-
var fullGitDirPath = Path.GetFullPath(Path.Combine(startingDir, relativeGitDirPath));
132+
var fullGitDirPath = Path.GetFullPath(PathHelper.Combine(startingDir, relativeGitDirPath));
132133
if (Directory.Exists(fullGitDirPath))
133134
{
134135
return (fullGitDirPath, Path.GetDirectoryName(dirOrFilePath)!);

src/GitVersion.Core/Helpers/PathHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ internal static class PathHelper
44
{
55
public static string NewLine => SysEnv.NewLine;
66

7-
public static readonly StringComparison OsDependentComparison = SysEnv.OSVersion.Platform switch
7+
private static readonly StringComparison OsDependentComparison = SysEnv.OSVersion.Platform switch
88
{
99
PlatformID.Unix or PlatformID.MacOSX => StringComparison.Ordinal,
1010
_ => StringComparison.OrdinalIgnoreCase,

src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA
169169
var extension = FileHelper.GetFileExtension(language);
170170
using var result = ExecuteMsBuildExe(project =>
171171
{
172-
var intermediateOutputPath = Path.Combine("$(MSBuildProjectDirectory)", randDir);
172+
var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir);
173173
AddGenerateGitVersionInformationTask(project, taskName, taskName, outputProperty, language, intermediateOutputPath);
174174
}, language);
175175

@@ -200,7 +200,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA
200200
var extension = FileHelper.GetFileExtension(language);
201201
using var result = ExecuteMsBuildExeInAzurePipeline(project =>
202202
{
203-
var intermediateOutputPath = Path.Combine("$(MSBuildProjectDirectory)", randDir);
203+
var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir);
204204
AddGenerateGitVersionInformationTask(project, taskName, taskName, outputProperty, language, intermediateOutputPath);
205205
}, language);
206206

@@ -231,7 +231,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA
231231
var extension = FileHelper.GetFileExtension(language);
232232
using var result = ExecuteMsBuildExe(project =>
233233
{
234-
var intermediateOutputPath = Path.Combine("$(MSBuildProjectDirectory)", randDir);
234+
var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir);
235235
AddGenerateGitVersionInformationTask(project, taskName, taskName, outputProperty, language, intermediateOutputPath).Property("UseProjectNamespaceForGitVersionInformation", "True").Property("RootNamespace", "Test.Root");
236236
}, language);
237237

@@ -264,7 +264,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA
264264
var extension = FileHelper.GetFileExtension(language);
265265
using var result = ExecuteMsBuildExeInAzurePipeline(project =>
266266
{
267-
var intermediateOutputPath = Path.Combine("$(MSBuildProjectDirectory)", randDir);
267+
var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir);
268268
AddGenerateGitVersionInformationTask(project, taskName, taskName, outputProperty, language, intermediateOutputPath).Property("UseProjectNamespaceForGitVersionInformation", "True");
269269
}, language);
270270

src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi
143143
var extension = FileHelper.GetFileExtension(language);
144144
using var result = ExecuteMsBuildExe(project =>
145145
{
146-
var intermediateOutputPath = Path.Combine("$(MSBuildProjectDirectory)", randDir);
146+
var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir);
147147
AddUpdateAssemblyInfoTask(project, taskName, taskName, outputProperty, language, intermediateOutputPath);
148148
}, language);
149149

@@ -170,7 +170,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi
170170
var extension = FileHelper.GetFileExtension(language);
171171
using var result = ExecuteMsBuildExeInAzurePipeline(project =>
172172
{
173-
var intermediateOutputPath = Path.Combine("$(MSBuildProjectDirectory)", randDir);
173+
var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir);
174174
AddUpdateAssemblyInfoTask(project, taskName, taskName, outputProperty, language, intermediateOutputPath);
175175
}, language);
176176

src/GitVersion.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using GitVersion.Helpers;
12
using LibGit2Sharp;
23

34
namespace GitVersion.Testing;
@@ -25,7 +26,7 @@ public BaseGitFlowRepositoryFixture(Action<IRepository> initialMainAction, strin
2526

2627
private void SetupRepo(Action<IRepository> initialMainAction)
2728
{
28-
var randomFile = Path.Combine(Repository.Info.WorkingDirectory, Guid.NewGuid().ToString());
29+
var randomFile = PathHelper.Combine(Repository.Info.WorkingDirectory, Guid.NewGuid().ToString());
2930
File.WriteAllText(randomFile, string.Empty);
3031
Commands.Stage(Repository, randomFile);
3132

src/GitVersion.Testing/GitTestExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static Commit[] MakeCommits(this IRepository repository, int numCommitsTo
2323

2424
private static Commit CreateFileAndCommit(this IRepository repository, string relativeFileName, string? commitMessage = null)
2525
{
26-
var randomFile = Path.Combine(repository.Info.WorkingDirectory, relativeFileName);
26+
var randomFile = PathHelper.Combine(repository.Info.WorkingDirectory, relativeFileName);
2727
if (File.Exists(randomFile))
2828
{
2929
File.Delete(randomFile);

src/GitVersion.Testing/Helpers/DirectoryHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using GitVersion.Helpers;
2+
13
namespace GitVersion.Testing.Internal;
24

35
internal static class DirectoryHelper
@@ -19,7 +21,7 @@ public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo targ
1921

2022
foreach (var file in source.GetFiles())
2123
{
22-
file.CopyTo(Path.Combine(target.FullName, Rename(file.Name)));
24+
file.CopyTo(PathHelper.Combine(target.FullName, Rename(file.Name)));
2325
}
2426
}
2527

0 commit comments

Comments
 (0)