Skip to content

Fix duplications in --dependency-tree and --depependency-tree-fullpath output

When invoking getModulesForProject with the "workspace" as a $proj parameter, the @results contains duplicates.

Fistly we go into this condition:

if ($proj !~ /\*/ && $proj !~ /\.git$/)

in which the findResults is run, and then $proj is changed to "workspace/*".

Then we go to the else block of

if ($proj !~ /\*/ && $proj !~ /\// && exists $repositoryRef->{$proj})

in which the findResults is run again.

This leads to having all entries appeared twice in @results array.

This change removes duplicates by using List::Util uniq.

Note, possibly, it is better to change the flow of this function in the first place.

Merge request reports