]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - ikiwiki-transition
move dedup code into function, simplify
[git.ikiwiki.info.git] / ikiwiki-transition
index b15d9f46b825a50ddd47bacff59ceb85c33edf2e..599261a093d798f818942e90577ff07a86d09a44 100755 (executable)
@@ -201,10 +201,15 @@ sub moveprefs {
                foreach my $admin (@{$config{adminuser}}) {
                        my $a=IkiWiki::userinfo_get($admin, $field);
                        if (defined $a && length $a &&
-                           $a ne $orig && # might already have been moved
-                           defined $config{$field} &&
-                           length $config{$field}) {
-                                $config{$field}=IkiWiki::pagespec_merge($config{$field}, $a);
+                           # might already have been moved
+                           (! defined $orig || $a ne $orig)) {
+                               if (defined $config{$field} &&
+                                   length $config{$field}) {
+                                       $config{$field}=IkiWiki::pagespec_merge($config{$field}, $a);
+                               }
+                               else {
+                                       $config{$field}=$a;
+                               }
                        }
                }
        }