From: Joey Hess Date: Tue, 8 Dec 2009 19:57:50 +0000 (-0500) Subject: Fix handling of a repository in "." X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/85ecfb40a19334d7ea53de8b982915eff3cae07d?ds=sidebyside Fix handling of a repository in "." I threw in an abs_path because a repository in "." would turn into something like "/home/joey/." I think this is a reasonably safe change. --- diff --git a/debian/changelog b/debian/changelog index d91b3f9..00caea6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ mr (0.45) UNRELEASED; urgency=low * bootstrap: Improve stats display. * Add --insecure option that can be used to ignore SSL cert errors when bootstrapping. (Pavel Avgustinov) + * Fix handling of a repository in "." -- Joey Hess Wed, 25 Nov 2009 17:27:23 -0500 diff --git a/mr b/mr index 620ad7f..b5d5c11 100755 --- a/mr +++ b/mr @@ -787,6 +787,13 @@ sub repolist { } @list; } +sub repodir { + my $repo=shift; + my $topdir=$repo->{topdir}; + my $subdir=$repo->{subdir}; + return abs_path(($subdir =~/^\//) ? $subdir : $topdir.$subdir); +} + # figure out which repos to act on sub selectrepos { my @repos; @@ -795,7 +802,7 @@ sub selectrepos { my $subdir=$repo->{subdir}; next if $subdir eq 'DEFAULT'; - my $dir=($subdir =~/^\//) ? $subdir : $topdir.$subdir; + my $dir=repodir($repo); my $d=$directory; $dir.="/" unless $dir=~/\/$/; $d.="/" unless $d=~/\/$/; @@ -815,7 +822,7 @@ sub selectrepos { my $subdir=$repo->{subdir}; next if $subdir eq 'DEFAULT'; - my $dir=($subdir =~/^\//) ? $subdir : $topdir.$subdir; + my $dir=repodir($repo); my $d=$directory; $dir.="/" unless $dir=~/\/$/; $d.="/" unless $d=~/\/$/;