mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +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++) {
|
for ($diff_id = $from; $diff_id <= $to; $diff_id++) {
|
||||||
echo "Processing $diff_id";
|
echo "Processing $diff_id";
|
||||||
$diff = id(new DifferentialDiff())->load($diff_id);
|
$diff = id(new DifferentialDiff())->load($diff_id);
|
||||||
$diff->attachChangesets($diff->loadChangesets());
|
if ($diff) {
|
||||||
$orig_copy = array();
|
$diff->attachChangesets($diff->loadChangesets());
|
||||||
foreach ($diff->getChangesets() as $i => $changeset) {
|
$orig_copy = array();
|
||||||
$orig_copy[$i] = idx((array)$changeset->getMetadata(), 'copy:lines');
|
foreach ($diff->getChangesets() as $i => $changeset) {
|
||||||
$changeset->attachHunks($changeset->loadHunks());
|
$orig_copy[$i] = idx((array)$changeset->getMetadata(), 'copy:lines');
|
||||||
}
|
$changeset->attachHunks($changeset->loadHunks());
|
||||||
$diff->detectCopiedCode();
|
}
|
||||||
foreach ($diff->getChangesets() as $i => $changeset) {
|
$diff->detectCopiedCode();
|
||||||
if (idx($changeset->getMetadata(), 'copy:lines') || $orig_copy[$i]) {
|
foreach ($diff->getChangesets() as $i => $changeset) {
|
||||||
echo ".";
|
if (idx($changeset->getMetadata(), 'copy:lines') || $orig_copy[$i]) {
|
||||||
$changeset->save();
|
echo ".";
|
||||||
|
$changeset->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
Loading…
Reference in a new issue