]> sipb.mit.edu Git - ikiwiki.git/commitdiff
rename: remove duplicates that hook functions may have added to @torename
authorintrigeri <intrigeri@boum.org>
Sun, 8 Mar 2009 14:47:50 +0000 (15:47 +0100)
committerintrigeri <intrigeri@boum.org>
Sun, 8 Mar 2009 14:47:50 +0000 (15:47 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/rename.pm

index 38cebdba50d6e0c4a58376f0738c3df44a031103..d3ca8bd3a4b585d67b6792207bc1a89f76ade3e0 100644 (file)
@@ -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};