From 16d51e67a7e7257739e1cb3f9a3713d448065e5d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Oct 2008 19:53:04 -0400 Subject: add_underlay: avoid adding the same underlay twice --- IkiWiki.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'IkiWiki.pm') diff --git a/IkiWiki.pm b/IkiWiki.pm index 633c51381..edee8aacb 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -681,11 +681,12 @@ sub srcfile ($;$) { #{{{ sub add_underlay ($) { #{{{ my $dir=shift; - if ($dir=~/^\//) { - unshift @{$config{underlaydirs}}, $dir; + if ($dir !~ /^\//) { + $dir="$config{underlaydir}/../$dir"; } - else { - unshift @{$config{underlaydirs}}, "$config{underlaydir}/../$dir"; + + if (! grep { $_ eq $dir } @{$config{underlaydirs}}) { + unshift @{$config{underlaydirs}}, $dir; } return 1; -- cgit v1.2.3