(minor) setperms and DOS users
Supporting git on DOS may be a fact of life, but it felt good to make them use the "right" editor (hint: starts with v, ends with m, has three letters), or at least something equivalent, to produce their setperms input files. I'd say "yes Fred I know. However, Unix doesn't work like that, and when talking to a big, important, OS like Unix from your little single-user workstation, you do have to go the extra mile. It's not that different from going into a meeting with the CEO you know -- you dress up a little for that meeting don't you?". And Fred would nod, a little awed by the analogy. Maybe the awe was tinged with a wee bit of anger but not much; he knows there's a hierarchy among OSs, just like among people, and he knows where his OS stands in that hierarchy... ---- For the humour impaired, that was a joke. To start with, I don't know anyone called Fred. It *is* true that I tend to ignore DOS if at all possible, especially in my *code*. But since I don't really use wildrepos at work, this issue would never have come up for me, even in the DOS projects I manage. In this case someone who's contributed a heck of a lot to the evolution of gitolite asked, so here it is. ---- oh and in case you were wondering, DOS stands for "dominant operating system" ;-)
This commit is contained in:
parent
8710521f30
commit
6b65ffbab4
|
@ -9,6 +9,7 @@ use Exporter 'import';
|
||||||
check_repo_write_enabled
|
check_repo_write_enabled
|
||||||
cli_repo_rights
|
cli_repo_rights
|
||||||
dbg
|
dbg
|
||||||
|
dos2unix
|
||||||
list_phy_repos
|
list_phy_repos
|
||||||
ln_sf
|
ln_sf
|
||||||
log_it
|
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 {
|
sub log_it {
|
||||||
my ($ip, $logmsg);
|
my ($ip, $logmsg);
|
||||||
open my $log_fh, ">>", $ENV{GL_LOG} or die "open log failed: $!\n";
|
open my $log_fh, ">>", $ENV{GL_LOG} or die "open log failed: $!\n";
|
||||||
|
@ -310,8 +317,7 @@ sub new_wild_repo {
|
||||||
my %perm_cats;
|
my %perm_cats;
|
||||||
|
|
||||||
if ($user and -f "$REPO_BASE/$repo.git/gl-perms") {
|
if ($user and -f "$REPO_BASE/$repo.git/gl-perms") {
|
||||||
my $fh = wrap_open("<", "$REPO_BASE/$repo.git/gl-perms");
|
my ($perms) = dos2unix(slurp("$REPO_BASE/$repo.git/gl-perms"));
|
||||||
my $perms = join ("", <$fh>);
|
|
||||||
# discard comments
|
# discard comments
|
||||||
$perms =~ s/#.*//g;
|
$perms =~ s/#.*//g;
|
||||||
# convert R and RW to the actual category names in the config file
|
# convert R and RW to the actual category names in the config file
|
||||||
|
|
Loading…
Reference in a new issue