record and maintain a 'version' (for info and elsewhere)

This commit is contained in:
Sitaram Chamarty 2012-03-15 19:14:40 +05:30
parent 5e2563bb8c
commit afcd974afa
3 changed files with 17 additions and 1 deletions

View file

@ -7,6 +7,7 @@ package Gitolite::Rc;
%rc %rc
glrc glrc
query_rc query_rc
version
$REMOTE_COMMAND_PATT $REMOTE_COMMAND_PATT
$REF_OR_FILENAME_PATT $REF_OR_FILENAME_PATT
@ -102,7 +103,7 @@ sub glrc {
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# implements 'gitolite query-rc' # implements 'gitolite query-rc' and 'version'
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -131,6 +132,16 @@ sub query_rc {
exit 1; exit 1;
} }
sub version {
my $version = '';
$version = '(unknown)';
for ("$rc{GL_ADMIN_BASE}/VERSION") {
$version = slurp($_) if -r $_;
}
chomp($version);
return $version;
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
=for args =for args

View file

@ -95,6 +95,9 @@ sub setup_gladmin {
_mkdir( $rc{GL_ADMIN_BASE} ); _mkdir( $rc{GL_ADMIN_BASE} );
_chdir( $rc{GL_ADMIN_BASE} ); _chdir( $rc{GL_ADMIN_BASE} );
tsh_try("cd \$GL_BINDIR; git describe --tags --long --dirty=-dt 2>/dev/null")
and _print("VERSION", tsh_text());
_mkdir("conf"); _mkdir("conf");
my $conf; my $conf;
{ {

View file

@ -19,6 +19,8 @@ usage() if @ARGV;
my $user = $ENV{GL_USER} or _die "GL_USER not set"; my $user = $ENV{GL_USER} or _die "GL_USER not set";
my $ref = 'any'; my $ref = 'any';
print "hello $user, this is gitolite3 " . version() . " on git " . substr(`git --version`, 12) . "\n";
my $lr = lister_dispatch('list-repos'); my $lr = lister_dispatch('list-repos');
my $lm = lister_dispatch('list-members'); my $lm = lister_dispatch('list-members');