compile: REPO_BASE need not be under $HOME
In the "create new repos" loop, we need an absolute value for REPO_BASE, in order to be able to chdir back and forth. But (taking the "normal user with no privileges" assumption too far!) we assumed REPO_BASE would be within $HOME, and relative to it. So it fails when someone wants the repo_base elsewhere. Now we don't prefix $HOME if REPO_BASE is already absolute (begins with a "/") bug reported by evocallaghan
This commit is contained in:
parent
23e4c209eb
commit
3522087591
2 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
# this is meant to be pulled into a perl program using "do"
|
||||
|
||||
# base directory for all the repos
|
||||
# base directory for all the repos (absolute, or relative to $HOME)
|
||||
$REPO_BASE="repositories";
|
||||
|
||||
# gitolite admin directory, files, etc
|
||||
|
|
|
@ -184,7 +184,10 @@ close $compiled_fh or die "close compiled-conf failed: $!";
|
|||
# did not have that luxury, so it was forced to detect the first push and
|
||||
# create it then
|
||||
|
||||
my_chdir("$ENV{HOME}/$REPO_BASE");
|
||||
# repo-base needs to be an absolute path for this loop to work right
|
||||
# so if it was not already absolute, prefix $HOME.
|
||||
my $repo_base_abs = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
|
||||
my_chdir("$repo_base_abs");
|
||||
for my $repo (keys %repos)
|
||||
{
|
||||
unless (-d "$repo.git")
|
||||
|
@ -194,7 +197,7 @@ for my $repo (keys %repos)
|
|||
system("git init --bare");
|
||||
system("cp $GL_ADMINDIR/src/update-hook.pl hooks/update");
|
||||
system("chmod 755 hooks/update");
|
||||
my_chdir("$ENV{HOME}/$REPO_BASE");
|
||||
my_chdir("$repo_base_abs");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue