private static string ReadFileName(LineReader reader, string expectedPrefix)
{
string line = reader.Current.Trim();
if (!line.StartsWith(expectedPrefix))
{
throw new FormatException("Invalid Unified Diff header");
}
reader.NextLine();
// Extract file name
return line.Substring(3).Trim();
}