Skip to content

Commit 43ad3cf

Browse files
committed
Use the same lookup for source-branches validation
config.Branches.ContainsKey(x) does a fuzzy-ish match. In https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/Core/RepositoryMetadataProvider.cs#L475 it does a dictionary index lookup. I've changed the test to use the same approach which is more strict.
1 parent 629558f commit 43ad3cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/GitVersionCore/Configuration/ConfigurationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private static void ValidateConfiguration(Config config)
164164
throw new ConfigurationException($"Branch configuration '{name}' is missing required configuration 'source-branches'{System.Environment.NewLine}" + "See https://gitversion.net/docs/configuration/ for more info");
165165
}
166166

167-
var missingSourceBranches = sourceBranches.Where(sb => config.GetConfigForBranch(sb) == null).ToArray();
167+
var missingSourceBranches = sourceBranches.Where(sb => !config.Branches.ContainsKey(sb)).ToArray();
168168
if (missingSourceBranches.Any())
169169
throw new ConfigurationException($"Branch configuration '{name}' defines these 'source-branches' that are not configured: '[{string.Join(",", missingSourceBranches)}]'{System.Environment.NewLine}" + "See https://gitversion.net/docs/configuration/ for more info");
170170
}

0 commit comments

Comments
 (0)