11using System . IO . Abstractions ;
22using GitVersion . Configuration . Workflows ;
33using GitVersion . Extensions ;
4+ using GitVersion . Logging ;
45using Microsoft . Extensions . Options ;
56using YamlDotNet . Core ;
67
@@ -9,12 +10,14 @@ namespace GitVersion.Configuration;
910internal class ConfigurationProvider (
1011 IConfigurationFileLocator configFileLocator ,
1112 IFileSystem fileSystem ,
13+ ILog log ,
1214 IConfigurationSerializer configurationSerializer ,
1315 IOptions < GitVersionOptions > options )
1416 : IConfigurationProvider
1517{
1618 private readonly IConfigurationFileLocator configFileLocator = configFileLocator . NotNull ( ) ;
1719 private readonly IFileSystem fileSystem = fileSystem . NotNull ( ) ;
20+ private readonly ILog log = log . NotNull ( ) ;
1821 private readonly IConfigurationSerializer configurationSerializer = configurationSerializer . NotNull ( ) ;
1922 private readonly IOptions < GitVersionOptions > options = options . NotNull ( ) ;
2023
@@ -72,7 +75,19 @@ private IGitVersionConfiguration ProvideConfiguration(string? configFile,
7275
7376 private IReadOnlyDictionary < object , object ? > ? ReadOverrideConfiguration ( string ? configFilePath )
7477 {
75- if ( configFilePath == null || ! fileSystem . File . Exists ( configFilePath ) ) return null ;
78+ if ( configFilePath == null )
79+ {
80+ this . log . Info ( "No configuration file found, using default configuration" ) ;
81+ return null ;
82+ }
83+
84+ if ( ! this . fileSystem . File . Exists ( configFilePath ) )
85+ {
86+ this . log . Info ( $ "Configuration file '{ configFilePath } ' not found") ;
87+ return null ;
88+ }
89+
90+ this . log . Info ( $ "Using configuration file '{ configFilePath } '") ;
7691 var content = fileSystem . File . ReadAllText ( configFilePath ) ;
7792 return configurationSerializer . Deserialize < Dictionary < object , object ? > > ( content ) ;
7893 }
0 commit comments