From: Joey Hess Date: Thu, 11 Oct 2007 04:18:21 +0000 (-0400) Subject: allow .mrconfig to be a symlink X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/69cba0fdcf854e9ea567654c0b38e91b21226c88 allow .mrconfig to be a symlink abs_path would canonicalise the symlink and mr would try to from the directory of the file it pointed to, avoid that counterintive behavior --- diff --git a/mr b/mr index aa15728..0f80fc8 100755 --- a/mr +++ b/mr @@ -129,7 +129,7 @@ foreach my $topdir (sort keys %config) { if (defined $directory && $dir !~ /^\Q$directory\E\//) { - print "mr $action: $dir skipped per -d parameter\n" if $verbose; + print "mr $action: $dir skipped per -d parameter ($directory)\n" if $verbose; push @skipped, $dir; next; } @@ -212,16 +212,17 @@ sub loadconfig { $dir=""; } else { - $f=abs_path($f); - - if ($loaded{$f}) { + # $f might be a symlink + my $absf=abs_path($f); + if ($loaded{$absf}) { return; } - $loaded{$f}=1; + $loaded{$absf}=1; print "mr: loading config $f\n" if $verbose; open($in, "<", $f) || die "mr: open $f: $!\n"; ($dir)=$f=~/^(.*\/)[^\/]+$/; + $dir=abs_path($dir)."/"; # copy in defaults from first parent my $parent=$dir;