From: Joey Hess Date: Fri, 17 Oct 2008 23:53:04 +0000 (-0400) Subject: add_underlay: avoid adding the same underlay twice X-Git-Tag: 2.68~197 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=16d51e67a7e7257739e1cb3f9a3713d448065e5d;p=ikiwiki.git add_underlay: avoid adding the same underlay twice --- 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;