diff options
author | Raphael Medaer <rme@escaux.com> | 2016-04-08 15:14:20 +0200 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2016-05-07 10:14:55 +0530 |
commit | b921a192ea8baada0839529e33592385bd7cd116 (patch) | |
tree | cec13992d09d08b0a60d1563bacb21a40f4534a9 /src | |
parent | 6ed0156bd6e1fa6b0c31d7a2dfa4ae55203c617f (diff) |
gitolite setup: use '-m' to supply a custom commit message
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Gitolite/Setup.pm | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/lib/Gitolite/Setup.pm b/src/lib/Gitolite/Setup.pm index 43de5d9..8ad5d34 100644 --- a/src/lib/Gitolite/Setup.pm +++ b/src/lib/Gitolite/Setup.pm @@ -12,6 +12,7 @@ propagate hooks. -a, --admin <name> admin name -pk, --pubkey <file> pubkey file name -ho, --hooks-only skip other steps and just propagate hooks + -m, --message set setup commit message First run: either the pubkey or the admin name is *required*, depending on whether you're using ssh mode or http mode. @@ -30,6 +31,9 @@ Subsequent runs: - '-a' is ignored + - '-m' can be used to replace default commit message "gitolite setup $argv" + with a custom message (e.g. "Setting up your repository mgmt"). + =cut # ---------------------------------------------------------------------- @@ -50,11 +54,11 @@ use warnings; # ---------------------------------------------------------------------- sub setup { - my ( $admin, $pubkey, $h_only, $argv ) = args(); + my ( $admin, $pubkey, $h_only, $message ) = args(); unless ($h_only) { setup_glrc(); - setup_gladmin( $admin, $pubkey, $argv ); + setup_gladmin( $admin, $pubkey, $message ); _system("gitolite compile"); _system("gitolite trigger POST_COMPILE"); @@ -66,16 +70,18 @@ sub setup { # ---------------------------------------------------------------------- sub args { - my $admin = ''; - my $pubkey = ''; - my $h_only = 0; - my $help = 0; - my $argv = join( " ", @ARGV ); + my $admin = ''; + my $pubkey = ''; + my $message = ''; + my $h_only = 0; + my $help = 0; + my $argv = join( " ", @ARGV ); require Getopt::Long; Getopt::Long::GetOptions( 'admin|a=s' => \$admin, 'pubkey|pk=s' => \$pubkey, + 'message|m=s' => \$message, 'hooks-only|ho' => \$h_only, 'help|h' => \$help, ) or usage(); @@ -97,7 +103,7 @@ sub args { } - return ( $admin || '', $pubkey || '', $h_only || 0, $argv ); + return ( $admin || '', $pubkey || '', $h_only || 0, $message || "gitolite setup $argv"); } sub setup_glrc { @@ -105,7 +111,7 @@ sub setup_glrc { } sub setup_gladmin { - my ( $admin, $pubkey, $argv ) = @_; + my ( $admin, $pubkey, $message ) = @_; _die "'-pk' or '-a' required; see 'gitolite setup -h' for more" if not $admin and not -f "$rc{GL_ADMIN_BASE}/conf/gitolite.conf"; @@ -154,7 +160,7 @@ sub setup_gladmin { tsh_try("git config --get user.email") or tsh_run( "git config user.email $ENV{USER}\@" . `hostname` ); tsh_try("git config --get user.name") or tsh_run( "git config user.name '$ENV{USER} on '" . `hostname` ); tsh_try("git diff --cached --quiet") - or tsh_try("git commit -am 'gitolite setup $argv'") + or tsh_try("git commit -am '$message'") or _die "setup failed to commit to the admin repo"; delete $ENV{GIT_WORK_TREE}; } |