From 73492271a2c562827b367f45ce18611a5d483ffd Mon Sep 17 00:00:00 2001 From: JohanLarsson Date: Tue, 19 Mar 2024 09:50:35 +0100 Subject: [PATCH] Use two different error messages. #28 --- src/TfvcMigrator/Program.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TfvcMigrator/Program.cs b/src/TfvcMigrator/Program.cs index 1999691..ae66db1 100644 --- a/src/TfvcMigrator/Program.cs +++ b/src/TfvcMigrator/Program.cs @@ -253,10 +253,16 @@ pat is not null foreach (var (_, parentChangeset, parentBranch) in mappingState.AdditionalParents.Where(t => t.Branch == branch)) { - if (commitsByChangeset.TryGetValue(parentChangeset, out var createdChangesets) - && createdChangesets.SingleOrDefault(c => c.Branch == parentBranch).Commit is { } commit) + if (commitsByChangeset.TryGetValue(parentChangeset, out var createdChangesets)) { - parents.Add(commit); + if (createdChangesets.SingleOrDefault(c => c.Branch == parentBranch).Commit is { } commit) + { + parents.Add(commit); + } + else + { + throw new InvalidOperationException("Should not be reachable. Should be a single changeset matching parent branch."); + } } else {