compile+doc/3: deal with older gits
- detect/warn git version < 1.6.2 - create documentation with details on client-side workaround - change the "git init --bare" to (older) "git --bare init", since the old syntax still works anyway
This commit is contained in:
parent
86faae4d4c
commit
838dd65d5f
|
@ -3,6 +3,7 @@
|
||||||
In this document:
|
In this document:
|
||||||
|
|
||||||
* common errors and mistakes
|
* common errors and mistakes
|
||||||
|
* git version dependency
|
||||||
* other errors, warnings, notes...
|
* other errors, warnings, notes...
|
||||||
* differences from gitosis
|
* differences from gitosis
|
||||||
* two levels of access rights checking
|
* two levels of access rights checking
|
||||||
|
@ -25,6 +26,35 @@ In this document:
|
||||||
the client side also :-) In fact gitolite prepends `$REPO_BASE` when it
|
the client side also :-) In fact gitolite prepends `$REPO_BASE` when it
|
||||||
is required anyway, so you shouldn't do the same thing!
|
is required anyway, so you shouldn't do the same thing!
|
||||||
|
|
||||||
|
### git version dependency
|
||||||
|
|
||||||
|
Here's a workaround for a version dependency that the normal flow of gitolite
|
||||||
|
has.
|
||||||
|
|
||||||
|
When you edit your config file to create a new repo, and run
|
||||||
|
`src/gl-compile-conf`, gitolite creates an empty, bare repo for you.
|
||||||
|
Normally, you're expected to clone this on the client side, and start working
|
||||||
|
-- make your first commit(s), then push, etc.
|
||||||
|
|
||||||
|
However, cloning an empty repo requires a server side git version that is at
|
||||||
|
least 1.6.2. Gitolite detects this when creating a repo, and warns you.
|
||||||
|
|
||||||
|
The workaround is to use the older (gitosis-style) method on the client:
|
||||||
|
create an empty repo locally, make a commit or two, set an "origin" remote,
|
||||||
|
and then push. Something like:
|
||||||
|
|
||||||
|
mkdir my-new-project
|
||||||
|
cd my-new-project
|
||||||
|
git init
|
||||||
|
git commit --allow-empty -m 'Initial repository'
|
||||||
|
# or, if your client side git is too old for --allow-empty, just make some
|
||||||
|
# files, "git add" them, then "git commit"
|
||||||
|
git remote add origin git@gitolite-server:my-new-project.git
|
||||||
|
git push origin master:master
|
||||||
|
|
||||||
|
Once this is done, the repo is available for cloning by anyone else in the
|
||||||
|
normal way, since it's not empty anymore.
|
||||||
|
|
||||||
### other errors, warnings, notes...
|
### other errors, warnings, notes...
|
||||||
|
|
||||||
* cloning an empty repo is only possible with clients greater than 1.6.2.
|
* cloning an empty repo is only possible with clients greater than 1.6.2.
|
||||||
|
|
|
@ -192,6 +192,13 @@ close $compiled_fh or die "$ATTN close compiled-conf failed: $!\n";
|
||||||
# did not have that luxury, so it was forced to detect the first push and
|
# did not have that luxury, so it was forced to detect the first push and
|
||||||
# create it then
|
# create it then
|
||||||
|
|
||||||
|
# but it turns out not everyone has "modern" gits :)
|
||||||
|
my $git_version = `git --version`;
|
||||||
|
my ($gv_maj, $gv_min, $gv_patchrel) = ($git_version =~ m/git version (\d+)\.(\d+)\.(\d+)/);
|
||||||
|
die "$ATTN I can't understand $git_version\n" unless ($gv_maj >= 1);
|
||||||
|
$git_version = $gv_maj*10000 + $gv_min*100 + $gv_patchrel; # now it's "normalised"
|
||||||
|
my $git_too_old = 0;
|
||||||
|
|
||||||
# repo-base needs to be an absolute path for this loop to work right
|
# repo-base needs to be an absolute path for this loop to work right
|
||||||
# so if it was not already absolute, prefix $HOME.
|
# so if it was not already absolute, prefix $HOME.
|
||||||
my $repo_base_abs = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
|
my $repo_base_abs = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
|
||||||
|
@ -202,12 +209,18 @@ for my $repo (keys %repos)
|
||||||
{
|
{
|
||||||
mkdir("$repo.git") or die "$ATTN mkdir $repo.git failed: $!\n";
|
mkdir("$repo.git") or die "$ATTN mkdir $repo.git failed: $!\n";
|
||||||
wrap_chdir("$repo.git");
|
wrap_chdir("$repo.git");
|
||||||
system("git init --bare");
|
system("git --bare init");
|
||||||
system("cp $GL_ADMINDIR/src/update-hook.pl hooks/update");
|
system("cp $GL_ADMINDIR/src/update-hook.pl hooks/update");
|
||||||
chmod 0755, "hooks/update";
|
chmod 0755, "hooks/update";
|
||||||
wrap_chdir("$repo_base_abs");
|
wrap_chdir("$repo_base_abs");
|
||||||
|
$git_too_old++ if $git_version < 10602; # that's 1.6.2 to you
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
warn "\n\t\t***** WARNING *****\n" .
|
||||||
|
"\tyour git version is older than 1.6.2\n" .
|
||||||
|
"\tgitolite will work but you MUST read the section on\n" .
|
||||||
|
"\t\"git version dependency\" in doc/3-faq-tips-etc.mkd\n"
|
||||||
|
if $git_too_old;
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# "compile" ssh authorized_keys
|
# "compile" ssh authorized_keys
|
||||||
|
|
Loading…
Reference in a new issue