Skip to content

Commit 58746f7

Browse files
committed
ConfigFileLocator cleanup
1 parent b3312b7 commit 58746f7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/GitVersionCore/Configuration/ConfigFileLocator.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ protected ConfigFileLocator(IFileSystem fileSystem, ILog log)
1515
Log = log;
1616
}
1717

18-
public static IConfigFileLocator GetLocator(IFileSystem fileSystem, ILog log, string filePath = null) =>
19-
!string.IsNullOrEmpty(filePath)
20-
? (IConfigFileLocator) new NamedConfigFileLocator(filePath, fileSystem, log)
21-
: new DefaultConfigFileLocator(fileSystem, log);
22-
2318
public abstract bool HasConfigFileAt(string workingDirectory);
2419

2520
public abstract string GetConfigFilePath(string workingDirectory);

src/GitVersionTask/GitVersionTasks.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public static class GitVersionTasks
2121
private static readonly ILog log;
2222
private static readonly IEnvironment environment;
2323
private static readonly IFileSystem fileSystem;
24+
private static readonly IConfigFileLocator configFileLocator;
2425

2526
static GitVersionTasks()
2627
{
@@ -122,7 +123,12 @@ private static bool ExecuteGitVersionTask<T>(T task, Action<T> action)
122123
}
123124

124125
private static bool GetVersionVariables(GitVersionTaskBase task, out VersionVariables versionVariables)
125-
=> new ExecuteCore(fileSystem, environment, log, ConfigFileLocator.GetLocator(fileSystem, log, task.ConfigFilePath))
126+
=> new ExecuteCore(fileSystem, environment, log, GetLocator(task.ConfigFilePath))
126127
.TryGetVersion(task.SolutionDirectory, out versionVariables, task.NoFetch, new Authentication());
128+
129+
private static IConfigFileLocator GetLocator(string filePath = null) =>
130+
!string.IsNullOrEmpty(filePath)
131+
? (IConfigFileLocator) new NamedConfigFileLocator(filePath, fileSystem, log)
132+
: new DefaultConfigFileLocator(fileSystem, log);
127133
}
128134
}

0 commit comments

Comments
 (0)