Browse files

checklinks: Workaround to conserve BC for previous commit (absolute $…

…etc)
  • Loading branch information...
1 parent acb2b7b commit 4b3e57a113f6d8b2d940aff721c117cba04423b1 @derf derf committed Oct 18, 2010
Showing with 18 additions and 2 deletions.
  1. +18 −2 bin/checklinks
View
20 bin/checklinks
@@ -11,7 +11,7 @@ use Term::ANSIColor;
my $base = $ENV{HOME};
my $msglevel = 0;
my $remove = 0;
-my %substitute;
+my (%substitute, %bc_subst);
my $linkfile;
my $exit = 0;
my $ct_auto = 0;
@@ -182,6 +182,16 @@ GetOptions(
'r|remove' => \$remove,
);
+foreach my $key (keys %substitute) {
+
+ my $path = $substitute{$key};
+
+ $path =~ s/ ^ $ENV{HOME}//x;
+
+ $bc_subst{$key} = $path;
+
+}
+
if ($ct_auto) {
loop_links();
exit 0;
@@ -195,7 +205,13 @@ while (my $line = <$links>) {
chomp($line);
foreach my $key (keys(%substitute)) {
- $line =~ s/\$$key/$substitute{$key}/g;
+
+ if ($line =~ / ^ \S+ \s+ \S+ \s+ \$ /x) {
+ $line =~ s/\$$key/$substitute{$key}/g;
+ }
+ else {
+ $line =~ s/\$$key/$bc_subst{$key}/g;
+ }
}
my ($type, $src, $dst) = split(/\s+/, $line);

0 comments on commit 4b3e57a

Please sign in to comment.