From 9d0a208b2608be4f677d0ba21bde7780bd39b963 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sun, 25 Apr 2010 04:55:43 +0530 Subject: [PATCH] (adc) auth: git-init subcommand added The "fork" adc cannot simply do a "git clone..."; hooks and gl-creater won't get set up. We need a way to initiate the *creation* of a repo from a shell command, and then fetch the refs over. For a long time, we used to trick gitolite into creating a repo for us by simply using "git ls-remote host:reponame" ;-) Now we have an actual command, so we can say "ssh git@server git-init \'reponame\'" Yes; those single quotes are required. Deal with it. --- src/gl-auth-command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gl-auth-command b/src/gl-auth-command index 5a3a894..af46ab2 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -163,7 +163,7 @@ if ($ENV{SSH_ORIGINAL_COMMAND} =~ $CUSTOM_COMMANDS) { # git-receive-pack 'reponame.git' my ($verb, $repo) = ($ENV{SSH_ORIGINAL_COMMAND} =~ /^\s*(git\s+\S+|\S+)\s+'\/?(.*?)(?:\.git)?'/); -unless ( $verb and ( $verb =~ $R_COMMANDS or $verb =~ $W_COMMANDS ) and $repo and $repo =~ $REPONAME_PATT ) { +unless ( $verb and ( $verb eq 'git-init' or $verb =~ $R_COMMANDS or $verb =~ $W_COMMANDS ) and $repo and $repo =~ $REPONAME_PATT ) { # ok, it's not a normal git command; call the special command helper &special_cmd ($GL_ADMINDIR, $GL_CONF_COMPILED, $shell_allowed, $RSYNC_BASE, $HTPASSWD_FILE); exit; @@ -202,4 +202,4 @@ die "$aa access for $repo DENIED to $user\n" unless $perm =~ /$aa/; &log_it("$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$user\n"); $repo = "'$REPO_BASE/$repo.git'"; -exec("git", "shell", "-c", "$verb $repo"); +exec("git", "shell", "-c", "$verb $repo") unless $verb eq 'git-init';