diff --git a/src/cyclonedx/Commands/MergeCommand.cs b/src/cyclonedx/Commands/MergeCommand.cs index ba96777..1c09467 100644 --- a/src/cyclonedx/Commands/MergeCommand.cs +++ b/src/cyclonedx/Commands/MergeCommand.cs @@ -86,8 +86,14 @@ public static async Task Merge(MergeCommandOptions options) { Console.WriteLine($"Adding to input file list from " + OneInputFileList); string[] lines = File.ReadAllLines(OneInputFileList); - InputFiles.AddRange(lines); - Console.WriteLine($"Got " + lines.Length + " entries from " + OneInputFileList); + int count = 0; + foreach (string line in lines) { + if (string.IsNullOrEmpty(line)) continue; + if (InputFiles.Contains(line)) continue; + InputFiles.Add(line); + count++; + } + Console.WriteLine($"Got " + count + " new entries from " + OneInputFileList); } } @@ -99,8 +105,14 @@ public static async Task Merge(MergeCommandOptions options) { Console.WriteLine($"Adding to input file list from " + OneInputFileList); string[] lines = File.ReadAllText(OneInputFileList).Split('\0'); - InputFiles.AddRange(lines); - Console.WriteLine($"Got " + lines.Length + " entries from " + OneInputFileList); + int count = 0; + foreach (string line in lines) { + if (string.IsNullOrEmpty(line)) continue; + if (InputFiles.Contains(line)) continue; + InputFiles.Add(line); + count++; + } + Console.WriteLine($"Got " + count + " new entries from " + OneInputFileList); } }