diff --git a/docs/input/docs/usage/cli/arguments.md b/docs/input/docs/usage/cli/arguments.md
index 93cdd7445e..d6e3c94a04 100644
--- a/docs/input/docs/usage/cli/arguments.md
+++ b/docs/input/docs/usage/cli/arguments.md
@@ -42,9 +42,9 @@ GitVersion [path]
E.g. /output json /format {SemVer} - will output `1.2.3+beta.4`
/output json /format {Major}.{Minor} - will output `1.2`
/l Path to logfile.
- /config Path to config file (defaults to GitVersion.yml)
+ /config Path to config file (defaults to GitVersion.yml or GitVersion.yaml)
/showconfig Outputs the effective GitVersion config (defaults + custom
- from GitVersion.yml) in yaml format
+ from GitVersion.yml or GitVersion.yaml) in yaml format
/overrideconfig Overrides GitVersion config values inline (semicolon-
separated key value pairs e.g. /overrideconfig
label-prefix=Foo)
@@ -103,7 +103,7 @@ gitversion init Configuration utility for gitversion
## Override config
-`/overrideconfig [key=value]` will override appropriate `key` from 'GitVersion.yml'.
+`/overrideconfig [key=value]` will override appropriate `key` from 'GitVersion.yml' or 'GitVersion.yaml'.
To specify multiple options add multiple `/overrideconfig [key=value]` entries:
`/overrideconfig key1=value1 /overrideconfig key2=value2`.
@@ -135,7 +135,7 @@ Following options are supported:
Read more about [Configuration](/docs/reference/configuration).
-Using `override-config` on the command line will not change the contents of the config file `GitVersion.yml`.
+Using `override-config` on the command line will not change the contents of the config file `GitVersion.yml` or `GitVersion.yaml`.
### Example: How to override configuration option 'label-prefix' to use prefix 'custom'
diff --git a/src/GitVersion.App/GitVersionExecutor.cs b/src/GitVersion.App/GitVersionExecutor.cs
index 4df25cb89c..eb716e956a 100644
--- a/src/GitVersion.App/GitVersionExecutor.cs
+++ b/src/GitVersion.App/GitVersionExecutor.cs
@@ -143,7 +143,10 @@ private bool HandleNonMainCommand(GitVersionOptions gitVersionOptions, out int e
this.log.Info("Working directory: " + workingDirectory);
}
- this.configurationFileLocator.Verify(gitVersionOptions, this.repositoryInfo);
+ if (gitVersionOptions.RepositoryInfo.TargetUrl.IsNullOrWhiteSpace())
+ {
+ this.configurationFileLocator.Verify(workingDirectory, this.repositoryInfo.ProjectRootDirectory);
+ }
if (gitVersionOptions.Init)
{
diff --git a/src/GitVersion.App/OverrideConfigurationOptionParser.cs b/src/GitVersion.App/OverrideConfigurationOptionParser.cs
index d9a6a8ca60..c258fd93d3 100644
--- a/src/GitVersion.App/OverrideConfigurationOptionParser.cs
+++ b/src/GitVersion.App/OverrideConfigurationOptionParser.cs
@@ -17,7 +17,7 @@ internal class OverrideConfigurationOptionParser
///
///
///
- /// Lookup keys are created from to match 'GitVersion.yml'
+ /// Lookup keys are created from to match 'GitVersion.yml' or 'GitVersion.yaml' file
/// options as close as possible.
///
private static ILookup GetSupportedProperties() => typeof(GitVersionConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs
index a3f2413861..a717bb8cad 100644
--- a/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs
+++ b/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs
@@ -82,7 +82,7 @@ public void GetCurrentBranchShouldHandleBranches()
var result = this.buildServer.GetCurrentBranch(false);
// Assert
- result.ShouldBe($"refs/heads/feature/my-work");
+ result.ShouldBe("refs/heads/feature/my-work");
}
[Test]
diff --git a/src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs b/src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs
index a5170ebd91..22aa017ec9 100644
--- a/src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs
+++ b/src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs
@@ -39,6 +39,9 @@ public void Setup()
}
[TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultFileName)]
+ [TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultAlternativeFileName)]
+ [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName, ConfigurationFileLocator.DefaultFileName)]
+ [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName, ConfigurationFileLocator.DefaultAlternativeFileName)]
public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile, string workingConfigFile)
{
var repositoryConfigFilePath = SetupConfigFileContent(string.Empty, repoConfigFile, this.repoPath);
@@ -50,16 +53,17 @@ public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile,
exception.Message.ShouldBe(expectedMessage);
}
- [Test]
- public void NoWarnOnGitVersionYmlFile()
+ [TestCase(ConfigurationFileLocator.DefaultFileName)]
+ [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName)]
+ public void NoWarnOnGitVersionYmlFile(string configurationFile)
{
- SetupConfigFileContent(string.Empty, ConfigurationFileLocator.DefaultFileName, this.repoPath);
+ SetupConfigFileContent(string.Empty, configurationFile, this.repoPath);
- Should.NotThrow(() => this.configurationProvider.ProvideInternal(this.repoPath));
+ Should.NotThrow(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
}
[Test]
- public void NoWarnOnNoGitVersionYmlFile() => Should.NotThrow(() => this.configurationProvider.ProvideInternal(this.repoPath));
+ public void NoWarnOnNoGitVersionYmlFile() => Should.NotThrow(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
private string SetupConfigFileContent(string text, string fileName, string path)
{
@@ -74,6 +78,7 @@ public class NamedConfigurationFileLocatorTests : TestBase
{
private const string DefaultRepoPath = @"c:\MyGitRepo";
private const string DefaultWorkingPath = @"c:\MyGitRepo\Working";
+ private const string myConfigYaml = "my-config.yaml";
private string repoPath;
private string workingPath;
@@ -84,7 +89,7 @@ public class NamedConfigurationFileLocatorTests : TestBase
[SetUp]
public void Setup()
{
- this.gitVersionOptions = new GitVersionOptions { ConfigurationInfo = { ConfigurationFile = "my-config.yaml" } };
+ this.gitVersionOptions = new GitVersionOptions { ConfigurationInfo = { ConfigurationFile = myConfigYaml } };
this.repoPath = DefaultRepoPath;
this.workingPath = DefaultWorkingPath;
@@ -167,7 +172,7 @@ public void NoWarnOnCustomYmlFile()
var configurationProvider = (ConfigurationProvider)sp.GetRequiredService();
- configurationProvider.ProvideInternal(this.repoPath);
+ configurationProvider.ProvideForDirectory(this.repoPath);
stringLogger.Length.ShouldBe(0);
}
@@ -188,7 +193,7 @@ public void NoWarnOnCustomYmlFileOutsideRepoPath()
var configurationProvider = (ConfigurationProvider)sp.GetRequiredService();
- configurationProvider.ProvideInternal(this.repoPath);
+ configurationProvider.ProvideForDirectory(this.repoPath);
stringLogger.Length.ShouldBe(0);
}
@@ -200,20 +205,24 @@ public void ThrowsExceptionOnCustomYmlFileDoesNotExist()
var exception = Should.Throw(() => this.configFileLocator.Verify(this.workingPath, this.repoPath));
- var workingPathFileConfig = PathHelper.Combine(this.workingPath, this.gitVersionOptions.ConfigurationInfo.ConfigurationFile);
- var repoPathFileConfig = PathHelper.Combine(this.repoPath, this.gitVersionOptions.ConfigurationInfo.ConfigurationFile);
+ var configurationFile = this.gitVersionOptions.ConfigurationInfo.ConfigurationFile;
+ var workingPathFileConfig = PathHelper.Combine(this.workingPath, configurationFile);
+ var repoPathFileConfig = PathHelper.Combine(this.repoPath, configurationFile);
var expectedMessage = $"The configuration file was not found at '{workingPathFileConfig}' or '{repoPathFileConfig}'";
exception.Message.ShouldBe(expectedMessage);
}
private string SetupConfigFileContent(string text, string? fileName = null, string? path = null)
{
- if (fileName.IsNullOrEmpty()) fileName = this.configFileLocator.FilePath;
+ if (fileName.IsNullOrEmpty())
+ {
+ fileName = gitVersionOptions.ConfigurationInfo.ConfigurationFile;
+ }
var filePath = fileName;
if (!path.IsNullOrEmpty())
filePath = PathHelper.Combine(path, filePath);
this.fileSystem.WriteAllText(filePath, text);
- return filePath;
+ return filePath!;
}
private static IServiceProvider GetServiceProvider(GitVersionOptions gitVersionOptions, ILog? log = null) =>
diff --git a/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs b/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs
index 5d5bb2fef5..6d78ea419f 100644
--- a/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs
+++ b/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs
@@ -33,7 +33,7 @@ public void Setup()
[Test]
public void OverwritesDefaultsWithProvidedConfig()
{
- var defaultConfig = this.configurationProvider.ProvideInternal(this.repoPath);
+ var defaultConfig = this.configurationProvider.ProvideForDirectory(this.repoPath);
const string text = @"
next-version: 2.0.0
branches:
@@ -41,7 +41,7 @@ public void OverwritesDefaultsWithProvidedConfig()
mode: ContinuousDeployment
label: dev";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.NextVersion.ShouldBe("2.0.0");
configuration.Branches.ShouldNotBeNull();
@@ -59,7 +59,7 @@ public void CanRemoveLabel()
release:
label: """"";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.NextVersion.ShouldBe("2.0.0");
configuration.Branches["release"].Label.ShouldBe(string.Empty);
@@ -74,7 +74,7 @@ public void RegexIsRequired()
bug:
label: bugfix";
SetupConfigFileContent(text);
- var ex = Should.Throw(() => this.configurationProvider.ProvideInternal(this.repoPath));
+ var ex = Should.Throw(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
ex.Message.ShouldBe($"Branch configuration 'bug' is missing required configuration 'regex'{System.Environment.NewLine}" +
"See https://gitversion.net/docs/reference/configuration for more info");
}
@@ -89,7 +89,7 @@ public void SourceBranchIsRequired()
regex: 'bug[/-]'
label: bugfix";
SetupConfigFileContent(text);
- var ex = Should.Throw(() => this.configurationProvider.ProvideInternal(this.repoPath));
+ var ex = Should.Throw(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
ex.Message.ShouldBe($"Branch configuration 'bug' is missing required configuration 'source-branches'{System.Environment.NewLine}" +
"See https://gitversion.net/docs/reference/configuration for more info");
}
@@ -104,7 +104,7 @@ public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsM
label: bugfix
source-branches: [notconfigured]";
SetupConfigFileContent(text);
- var ex = Should.Throw(() => this.configurationProvider.ProvideInternal(this.repoPath));
+ var ex = Should.Throw(() => this.configurationProvider.ProvideForDirectory(this.repoPath));
ex.Message.ShouldBe($"Branch configuration 'bug' defines these 'source-branches' that are not configured: '[notconfigured]'{System.Environment.NewLine}" +
"See https://gitversion.net/docs/reference/configuration for more info");
}
@@ -121,7 +121,7 @@ public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wel
label: bugfix
source-branches: [{wellKnownBranchKey}]";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.Branches["bug"].SourceBranches.ShouldBe(new List { wellKnownBranchKey });
}
@@ -137,7 +137,7 @@ public void CanProvideConfigForNewBranch()
label: bugfix
source-branches: []";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.Branches["bug"].Regex.ShouldBe("bug[/-]");
configuration.Branches["bug"].Label.ShouldBe("bugfix");
@@ -148,7 +148,7 @@ public void NextVersionCanBeInteger()
{
const string text = "next-version: 2";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.NextVersion.ShouldBe("2.0");
}
@@ -158,7 +158,7 @@ public void NextVersionCanHaveEnormousMinorVersion()
{
const string text = "next-version: 2.118998723";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.NextVersion.ShouldBe("2.118998723");
}
@@ -168,7 +168,7 @@ public void NextVersionCanHavePatch()
{
const string text = "next-version: 2.12.654651698";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.NextVersion.ShouldBe("2.12.654651698");
}
@@ -177,7 +177,7 @@ public void NextVersionCanHavePatch()
[MethodImpl(MethodImplOptions.NoInlining)]
public void CanWriteOutEffectiveConfiguration()
{
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.ToString().ShouldMatchApproved();
}
@@ -192,7 +192,7 @@ public void CanUpdateAssemblyInformationalVersioningScheme()
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
configuration.AssemblyInformationalFormat.ShouldBe("{NugetVersion}");
@@ -208,7 +208,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
configuration.AssemblyInformationalFormat.ShouldBe("{Major}.{Minor}.{Patch}");
@@ -227,7 +227,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
configuration.AssemblyInformationalFormat.ShouldBe("{FullSemVer}");
@@ -238,7 +238,7 @@ public void CanReadDefaultDocument()
{
const string text = "";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
configuration.AssemblyInformationalFormat.ShouldBe(null);
@@ -280,12 +280,13 @@ public void NoWarnOnGitVersionYmlFile()
});
this.configurationProvider = (ConfigurationProvider)sp.GetRequiredService();
- this.configurationProvider.ProvideInternal(this.repoPath);
+ this.configurationProvider.ProvideForDirectory(this.repoPath);
stringLogger.Length.ShouldBe(0);
}
- private void SetupConfigFileContent(string text, string fileName = ConfigurationFileLocator.DefaultFileName) => SetupConfigFileContent(text, fileName, this.repoPath);
+ private void SetupConfigFileContent(string text, string fileName = ConfigurationFileLocator.DefaultFileName)
+ => SetupConfigFileContent(text, fileName, this.repoPath);
private void SetupConfigFileContent(string text, string fileName, string path)
{
@@ -304,7 +305,7 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop()
source-branches: ['develop']
label: dev";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.Branches["develop"].SourceBranches.ShouldBe(new List { "develop" });
}
@@ -319,7 +320,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop()
mode: ContinuousDeployment
label: dev";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.Branches["develop"].SourceBranches.ShouldBe(new List());
}
@@ -335,7 +336,7 @@ public void ShouldUseSpecifiedSourceBranchesForFeature()
source-branches: ['develop', 'release']
label: dev";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.Branches["feature"].SourceBranches.ShouldBe(new List { "develop", "release" });
}
@@ -350,7 +351,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
mode: ContinuousDeployment
label: dev";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.Branches["feature"].SourceBranches.ShouldBe(
new List { "develop", MainBranch, "release", "feature", "support", "hotfix" });
@@ -368,7 +369,7 @@ public void ShouldNotOverrideAnythingWhenOverrideConfigIsEmpty()
.WithNextVersion("1.2.3")
.WithLabelPrefix("custom-label-prefix-from-yml")
.Build();
- var overridenConfig = this.configurationProvider.ProvideInternal(this.repoPath);
+ var overridenConfig = this.configurationProvider.ProvideForDirectory(this.repoPath);
overridenConfig.AssemblyVersioningScheme.ShouldBe(expectedConfig.AssemblyVersioningScheme);
overridenConfig.AssemblyFileVersioningScheme.ShouldBe(expectedConfig.AssemblyFileVersioningScheme);
@@ -401,7 +402,7 @@ public void ShouldUseDefaultTagPrefixWhenNotSetInConfigFile()
{
const string text = "";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.LabelPrefix.ShouldBe(ConfigurationConstants.DefaultLabelPrefix);
}
@@ -411,7 +412,7 @@ public void ShouldUseTagPrefixFromConfigFileWhenProvided()
{
const string text = "label-prefix: custom-label-prefix-from-yml";
SetupConfigFileContent(text);
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
configuration.LabelPrefix.ShouldBe("custom-label-prefix-from-yml");
}
@@ -425,7 +426,7 @@ public void ShouldOverrideTagPrefixWithOverrideConfigValue([Values] bool tagPref
{
{ "label-prefix", "label-prefix-from-override-configuration" }
};
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath, overrideConfiguration);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath, overrideConfiguration);
configuration.LabelPrefix.ShouldBe("label-prefix-from-override-configuration");
}
@@ -440,7 +441,7 @@ public void ShouldNotOverrideDefaultTagPrefixWhenNotSetInOverrideConfig()
{ "next-version", "1.0.0" }
};
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath, overrideConfiguration);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath, overrideConfiguration);
configuration.LabelPrefix.ShouldBe(ConfigurationConstants.DefaultLabelPrefix);
}
@@ -454,7 +455,7 @@ public void ShouldNotOverrideTagPrefixFromConfigFileWhenNotSetInOverrideConfig()
{
{ "next-version", "1.0.0" }
};
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath, overrideConfiguration);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath, overrideConfiguration);
configuration.LabelPrefix.ShouldBe("custom-label-prefix-from-yml");
}
@@ -468,7 +469,7 @@ public void ShouldOverrideTagPrefixFromConfigFileWhenSetInOverrideConfig()
{
{ "label-prefix", "custom-label-prefix-from-console" }
};
- var configuration = this.configurationProvider.ProvideInternal(this.repoPath, overrideConfiguration);
+ var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath, overrideConfiguration);
configuration.LabelPrefix.ShouldBe("custom-label-prefix-from-console");
}
diff --git a/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs b/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs
index ea25577e2b..47b2d17dd3 100644
--- a/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs
+++ b/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs
@@ -30,6 +30,7 @@ public void CanSetNextVersion()
var fileSystem = sp.GetRequiredService();
configurationProvider.Init(workingDirectory);
- fileSystem.ReadAllText(PathHelper.Combine(workingDirectory, "GitVersion.yml")).ShouldMatchApproved();
+ var configFile = PathHelper.Combine(workingDirectory, ConfigurationFileLocator.DefaultFileName);
+ fileSystem.ReadAllText(configFile).ShouldMatchApproved();
}
}
diff --git a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs
index cac6ef4c56..6d604d5b59 100644
--- a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs
+++ b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs
@@ -241,8 +241,9 @@ public void CacheFileIsMissing()
logsMessages.ShouldContain("yml not found", Case.Insensitive, logsMessages);
}
- [Test]
- public void ConfigChangeInvalidatesCache()
+ [TestCase(ConfigurationFileLocator.DefaultFileName)]
+ [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName)]
+ public void ConfigChangeInvalidatesCache(string configFileName)
{
const string versionCacheFileContent = @"
Major: 4
@@ -289,7 +290,7 @@ public void ConfigChangeInvalidatesCache()
versionVariables = gitVersionCalculator.CalculateVersionVariables();
versionVariables.AssemblySemVer.ShouldBe("4.10.3.0");
- var configPath = PathHelper.Combine(fixture.RepositoryPath, ConfigurationFileLocator.DefaultFileName);
+ var configPath = PathHelper.Combine(fixture.RepositoryPath, configFileName);
this.fileSystem.WriteAllText(configPath, "next-version: 5.0.0");
gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions, fs: this.fileSystem);
diff --git a/src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs b/src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs
index fce68b6abf..3a716c613c 100644
--- a/src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs
+++ b/src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs
@@ -2,12 +2,8 @@ namespace GitVersion.Configuration;
public interface IConfigurationFileLocator
{
- string FilePath { get; }
- bool HasConfigFileAt(string workingDirectory);
- string? GetConfigFilePath(string workingDirectory);
- void Verify(GitVersionOptions gitVersionOptions, IGitRepositoryInfo repositoryInfo);
- void Verify(string workingDirectory, string projectRootDirectory);
- string? SelectConfigFilePath(GitVersionOptions gitVersionOptions, IGitRepositoryInfo repositoryInfo);
- GitVersionConfiguration ReadConfig(string workingDirectory);
- IReadOnlyDictionary