summaryrefslogtreecommitdiff
path: root/libpiny/lib
diff options
context:
space:
mode:
authorjrayhawk+piny.be@omgwallhack.org <jrayhawk+piny.be@omgwallhack.org>2011-06-12 23:43:20 -0700
committerjrayhawk+piny.be@omgwallhack.org <jrayhawk+piny.be@omgwallhack.org>2011-06-12 23:43:20 -0700
commitd79482cba6b7be41c20a4661f51ff25f00c5722c (patch)
treeff4b2e0f2a3bef8c6ae9014a2594dba56d74f4e4 /libpiny/lib
parent6af31393296abbe06eb3b7c0b4c60ab3d697618e (diff)
downloadpiny-code-d79482cba6b7be41c20a4661f51ff25f00c5722c.tar.gz
piny-code-d79482cba6b7be41c20a4661f51ff25f00c5722c.zip
Adding distinction between immutable and normal git file permissions
Diffstat (limited to 'libpiny/lib')
-rw-r--r--libpiny/lib/Piny/Repo.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm
index fea6846..f0299c8 100644
--- a/libpiny/lib/Piny/Repo.pm
+++ b/libpiny/lib/Piny/Repo.pm
@@ -240,6 +240,7 @@ sub rebuild_git {
my ( $s ) = @_;
my $dirperm;
+ my $immutablefileperm;
my $fileperm;
unless( getgrnam("git-" . $s->shortname ) ) {
@@ -261,15 +262,19 @@ sub rebuild_git {
if ( $s->config->core_sharedrepository eq "0666" ) {
$dirperm = "2777";
- $fileperm = "0644";
+ $immutablefileperm = "0644";
+ $fileperm = "0666";
} elsif ( $s->config->core_sharedrepository =~ /^(0664|all|everybody|world)$/ ) {
$dirperm = "2775";
- $fileperm = "0644";
+ $immutablefileperm = "0644";
+ $fileperm = "0664";
} elsif ( $s->config->core_sharedrepository =~ /^(0660|true|1|group)$/ ) {
$dirperm = "2770";
- $fileperm = "0640";
+ $immutablefileperm = "0640";
+ $fileperm = "0660";
} elsif ( $s->config->core_sharedrepository =~ /^(0640|false|0)$/ ) {
$dirperm = "2750";
+ $immutablefileperm = "0640";
$fileperm = "0640";
} else {
die $s->config->core_sharedrepository . "is an unhandled value!"
@@ -277,7 +282,8 @@ sub rebuild_git {
# FIXME: we should verify we are not breaking someone else's object hardlinks with these chmod or chown operations
system( "/usr/bin/find " . $s->path . "/refs " . $s->path . "/info " . $s->path . "/branches " . $s->path . "/objects " . $s->path . "/logs " . $s->path . "/HEAD " . $s->path . "/packed-refs -type d -print0 | /usr/bin/xargs -0 /bin/chmod $dirperm" ) and die "Could not chmod shared git resources!";
- system( "/usr/bin/find " . $s->path . "/refs " . $s->path . "/info " . $s->path . "/branches " . $s->path . "/objects " . $s->path . "/logs " . $s->path . "/HEAD " . $s->path . "/packed-refs -type f -print0 | /usr/bin/xargs -0 /bin/chmod $fileperm" ) and die "Could not chmod shared git resources!"; # most files are either immutable or replaced at link level
+ system( "/usr/bin/find " . $s->path . "/objects " . "-type f -print0 | /usr/bin/xargs -0 /bin/chmod $immutablefileperm" ) and die "Could not chmod shared git resources!"; # most files are either immutable or replaced at link level
+ system( "/usr/bin/find " . $s->path . "/refs " . $s->path . "/info " . $s->path . "/branches " . $s->path . "/logs " . $s->path . "/HEAD " . $s->path . "/packed-refs -type f -print0 | /usr/bin/xargs -0 /bin/chmod $fileperm" ) and die "Could not chmod shared git resources!"; # most files are either immutable or replaced at link level
system( "/usr/bin/find " . $s->path . "/refs " . $s->path . "/info " . $s->path . "/branches " . $s->path . "/objects " . $s->path . "/logs " . $s->path . "/HEAD " . $s->path . "/packed-refs -print0 | /usr/bin/xargs -0 /bin/chgrp " . $s->group->name ) and die "Could not chgrp shared git resources!";
$ENV{"GIT_DIR"} = $s->path;