[Bps-public-commit] UNNAMED PROJECT branch, master, updated. fd0c07e18d17a58949a4434e7099e639e8e7e2dd

Alex M Vandiver alexmv at bestpractical.com
Wed May 27 11:58:42 EDT 2009


The branch, master has been updated
       via  fd0c07e18d17a58949a4434e7099e639e8e7e2dd (commit)
       via  6cc93b65e58cada9426f93bda87cb17b242d5573 (commit)
       via  ea8f92477835bdd3fdd55654b0b077a057e1970e (commit)
      from  cdf7785b7a8280ba55a4c5bb443ce375d514d501 (commit)

Summary of changes:
 lib/Config/GitLike.pm          |    7 +++++--
 lib/Config/GitLike/Cascaded.pm |    8 ++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit ea8f92477835bdd3fdd55654b0b077a057e1970e
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Wed May 27 11:53:49 2009 -0400

    Make ->load_dirs and ->load take which directory, defaulting to the cwd during ->load

diff --git a/lib/Config/GitLike.pm b/lib/Config/GitLike.pm
index 4550e49..afc292f 100644
--- a/lib/Config/GitLike.pm
+++ b/lib/Config/GitLike.pm
@@ -51,10 +51,11 @@ sub is_multiple {
 
 sub load {
     my $self = shift;
+    my $path = shift || Cwd::cwd;
     $self->data({});
     $self->load_global;
     $self->load_user;
-    $self->load_dirs;
+    $self->load_dirs( $path );
     return $self->data;
 }
 
@@ -65,7 +66,8 @@ sub dir_file {
 
 sub load_dirs {
     my $self = shift;
-    my($vol, $dirs, undef) = File::Spec->splitpath( Cwd::cwd, 1 );
+    my $path = shift;
+    my($vol, $dirs, undef) = File::Spec->splitpath( $path, 1 );
     my @dirs = File::Spec->splitdir( $dirs );
     while (@dirs) {
         my $path = File::Spec->catpath( $vol, File::Spec->catdir(@dirs), $self->dir_file );
diff --git a/lib/Config/GitLike/Cascaded.pm b/lib/Config/GitLike/Cascaded.pm
index 3cd1596..d00d4ce 100644
--- a/lib/Config/GitLike/Cascaded.pm
+++ b/lib/Config/GitLike/Cascaded.pm
@@ -11,7 +11,8 @@ extends 'Config::GitLike';
 
 sub load_dirs {
     my $self = shift;
-    my($vol, $dirs, undef) = File::Spec->splitpath( Cwd::cwd, 1 );
+    my $path = shift;
+    my($vol, $dirs, undef) = File::Spec->splitpath( $path, 1 );
     my @dirs = File::Spec->splitdir( $dirs );
     while (@dirs) {
         my $path = File::Spec->catpath( $vol, File::Spec->catdir(@dirs), $self->dir_file );

commit 6cc93b65e58cada9426f93bda87cb17b242d5573
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Wed May 27 11:54:28 2009 -0400

    Make Config::GitLike->load_dirs correctly walk up the directory tree

diff --git a/lib/Config/GitLike.pm b/lib/Config/GitLike.pm
index afc292f..5b17bed 100644
--- a/lib/Config/GitLike.pm
+++ b/lib/Config/GitLike.pm
@@ -75,6 +75,7 @@ sub load_dirs {
             $self->load_file( $path );
             last;
         }
+        pop @dirs;
     }
 }
 

commit fd0c07e18d17a58949a4434e7099e639e8e7e2dd
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Wed May 27 11:58:14 2009 -0400

    In ::Cascading, deeper dirs are loaded later and override earlier and shallower ones

diff --git a/lib/Config/GitLike/Cascaded.pm b/lib/Config/GitLike/Cascaded.pm
index d00d4ce..f637eb2 100644
--- a/lib/Config/GitLike/Cascaded.pm
+++ b/lib/Config/GitLike/Cascaded.pm
@@ -14,10 +14,9 @@ sub load_dirs {
     my $path = shift;
     my($vol, $dirs, undef) = File::Spec->splitpath( $path, 1 );
     my @dirs = File::Spec->splitdir( $dirs );
-    while (@dirs) {
-        my $path = File::Spec->catpath( $vol, File::Spec->catdir(@dirs), $self->dir_file );
+    for my $i ( 1 .. $#dirs ) {
+        my $path = File::Spec->catpath( $vol, File::Spec->catdir(@dirs[0..$i]), $self->dir_file );
         $self->load_file( $path ) if -e $path;
-        pop @dirs;
     }
 }
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list