diff --git a/src/gitolite.pm b/src/gitolite.pm index 885372c..bfced77 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -9,6 +9,7 @@ use Exporter 'import'; check_repo_write_enabled cli_repo_rights dbg + dos2unix list_phy_repos ln_sf log_it @@ -140,6 +141,12 @@ sub dbg { } } +sub dos2unix { + # WARNING: when calling this, make sure you supply a list context + s/\r\n/\n/g for @_; + return @_; +} + sub log_it { my ($ip, $logmsg); open my $log_fh, ">>", $ENV{GL_LOG} or die "open log failed: $!\n"; @@ -310,8 +317,7 @@ sub new_wild_repo { my %perm_cats; if ($user and -f "$REPO_BASE/$repo.git/gl-perms") { - my $fh = wrap_open("<", "$REPO_BASE/$repo.git/gl-perms"); - my $perms = join ("", <$fh>); + my ($perms) = dos2unix(slurp("$REPO_BASE/$repo.git/gl-perms")); # discard comments $perms =~ s/#.*//g; # convert R and RW to the actual category names in the config file