From: intrigeri Date: Sun, 8 Mar 2009 14:47:50 +0000 (+0100) Subject: rename: remove duplicates that hook functions may have added to @torename X-Git-Tag: 3.15~210 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/1efb182d56931974aebbc9029e98ccf28adcf043 rename: remove duplicates that hook functions may have added to @torename Signed-off-by: intrigeri --- diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 38cebdba5..d3ca8bd3a 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -318,8 +318,14 @@ sub sessioncgi ($$) { cgi => $q, session => $session, ); - # FIXME: remove duplicates (based on src or srcfile key) - # from @torename + + # remove duplicates from @torename + my %seen=(); + my @uniq_torename; + foreach my $item (@torename) { + push(@uniq_torename, $item) unless $seen{$item->{src}}++; + } + @torename=@uniq_torename; require IkiWiki::Render; IkiWiki::disable_commit_hook() if $config{rcs};