mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Make old and new files when checking for changes by commit
Summary: We have some false positives on commit changes checker. I'm not sure if the reason is a difference between `git diff` and `svn diff` or something else but making this more robust doesn't harm anything. We couldn't make the files from the whole changeset because I want to ignore context bigger than `$num_lines` to reduce rebase noise. Test Plan: Ran the method on diff which had false positive previously. Ran the method on a diff with real change. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3107
This commit is contained in:
parent
3c7944d297
commit
9092994e45
1 changed files with 21 additions and 3 deletions
|
@ -292,9 +292,27 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
|
||||||
if ($files[$file_phid]->loadFileData() != $corpus) {
|
if ($files[$file_phid]->loadFileData() != $corpus) {
|
||||||
return $vs_diff;
|
return $vs_diff;
|
||||||
}
|
}
|
||||||
} else if ($changeset->makeChangesWithContext() !=
|
} else {
|
||||||
$vs_changeset->makeChangesWithContext()) {
|
$context = implode("\n", $changeset->makeChangesWithContext());
|
||||||
return $vs_diff;
|
$vs_context = implode("\n", $vs_changeset->makeChangesWithContext());
|
||||||
|
|
||||||
|
// We couldn't just compare $context and $vs_context because following
|
||||||
|
// diffs will be considered different:
|
||||||
|
//
|
||||||
|
// -(empty line)
|
||||||
|
// -echo 'test';
|
||||||
|
// (empty line)
|
||||||
|
//
|
||||||
|
// (empty line)
|
||||||
|
// -echo "test";
|
||||||
|
// -(empty line)
|
||||||
|
|
||||||
|
$hunk = id(new DifferentialHunk())->setChanges($context);
|
||||||
|
$vs_hunk = id(new DifferentialHunk())->setChanges($vs_context);
|
||||||
|
if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() ||
|
||||||
|
$hunk->makeNewFile() != $vs_hunk->makeNewFile()) {
|
||||||
|
return $vs_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue