Skip to content

Use diff-filter to filter files that are not present in both base/diff #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/jit-analyze/jit-analyze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,8 @@ public static Dictionary<string, int> DiffInText(string diffPath, string basePat
List<string> commandArgs = new List<string>();
commandArgs.Add("diff");
commandArgs.Add("--no-index");
// only diff files that are present in both base and diff.
commandArgs.Add("--diff-filter=M");
commandArgs.Add("--exit-code");
commandArgs.Add("--numstat");
commandArgs.Add(diffPath);
Expand Down Expand Up @@ -1068,15 +1070,15 @@ public static Dictionary<string, int> DiffInText(string diffPath, string basePat

if (fields.Length != numFields)
{
Console.WriteLine($"Couldn't parse --numstat output '{line}` : {fields.Length} fields");
Console.WriteLine($"Couldn't parse output '{line}`.");
continue;
}

// store diff-relative path
string fullBaseFilePath = Path.GetFullPath(fields[2]);
if (!File.Exists(fullBaseFilePath))
{
Console.WriteLine($"Couldn't parse --numstat output '{line}` : '{fullBaseFilePath}' does not exist");
Console.WriteLine($"Couldn't parse output '{line}'.");
continue;
}

Expand Down