mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Ignore non-existing diffs in copied code detector script
Auditors: epriestley
This commit is contained in:
parent
e08b4cbb2c
commit
f362e5785f
1 changed files with 13 additions and 11 deletions
|
@ -29,17 +29,19 @@ list(, $from, $to) = $argv;
|
|||
for ($diff_id = $from; $diff_id <= $to; $diff_id++) {
|
||||
echo "Processing $diff_id";
|
||||
$diff = id(new DifferentialDiff())->load($diff_id);
|
||||
$diff->attachChangesets($diff->loadChangesets());
|
||||
$orig_copy = array();
|
||||
foreach ($diff->getChangesets() as $i => $changeset) {
|
||||
$orig_copy[$i] = idx((array)$changeset->getMetadata(), 'copy:lines');
|
||||
$changeset->attachHunks($changeset->loadHunks());
|
||||
}
|
||||
$diff->detectCopiedCode();
|
||||
foreach ($diff->getChangesets() as $i => $changeset) {
|
||||
if (idx($changeset->getMetadata(), 'copy:lines') || $orig_copy[$i]) {
|
||||
echo ".";
|
||||
$changeset->save();
|
||||
if ($diff) {
|
||||
$diff->attachChangesets($diff->loadChangesets());
|
||||
$orig_copy = array();
|
||||
foreach ($diff->getChangesets() as $i => $changeset) {
|
||||
$orig_copy[$i] = idx((array)$changeset->getMetadata(), 'copy:lines');
|
||||
$changeset->attachHunks($changeset->loadHunks());
|
||||
}
|
||||
$diff->detectCopiedCode();
|
||||
foreach ($diff->getChangesets() as $i => $changeset) {
|
||||
if (idx($changeset->getMetadata(), 'copy:lines') || $orig_copy[$i]) {
|
||||
echo ".";
|
||||
$changeset->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
|
|
Loading…
Reference in a new issue