[Bps-public-commit] Config-GitLike branch, master, updated. 1.07-1-geaac3d6
Alex Vandiver
alexmv at bestpractical.com
Wed Feb 15 22:02:01 EST 2012
The branch, master has been updated
via eaac3d652dc9544390b891a426092d165576acd7 (commit)
from 87a874eeab2eff0e1ce97b02b1f06a7d5f764b48 (commit)
Summary of changes:
lib/Config/GitLike.pm | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit eaac3d652dc9544390b891a426092d165576acd7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Feb 15 21:50:56 2012 -0500
Fix loading of user_file, due to unexpanded ~ in default path
Previously, ~ expansion was done in ->load_file, but ->load_user checked
the file-ness of the raw value of ->user_file, which included a ~. This
means that user files were generally only loaded because the target
directory was beneath the user's home directory -- and
Config::GitLike::Git _never_ loaded the user's ~/.gitconfig !
Instead of having ->load_user and ->load_global check the validity of
their arguments explicitly, rely on ->load_file's ability to tolerate
being called on non-existant files. Push the previous -f check down
into ->_read_config to handle odd corner cases, such as the filename
being to a directory, which open() tolerates on some systems.
Reported-by: Chia-liang Kao <clkao at clkao.org>
diff --git a/lib/Config/GitLike.pm b/lib/Config/GitLike.pm
index 6ba0d51..bdbaf87 100644
--- a/lib/Config/GitLike.pm
+++ b/lib/Config/GitLike.pm
@@ -114,7 +114,6 @@ sub global_file {
sub load_global {
my $self = shift;
- return unless -f $self->global_file;
return $self->load_file( $self->global_file );
}
@@ -126,7 +125,6 @@ sub user_file {
sub load_user {
my $self = shift;
- return unless -f $self->user_file;
return $self->load_file( $self->user_file );
}
@@ -135,6 +133,7 @@ sub _read_config {
my $self = shift;
my $filename = shift;
+ return unless -f $filename and -r $filename;
open(my $fh, '<', $filename) or return;
my $c = do {local $/; <$fh>};
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list