]> source.dussan.org Git - gitblit.git/commitdiff
Pass IGitblit into the SSH command context
authorJames Moger <james.moger@gitblit.com>
Sun, 16 Mar 2014 20:02:57 +0000 (16:02 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 10 Apr 2014 22:58:08 +0000 (18:58 -0400)
src/main/java/com/gitblit/transport/ssh/SshCommandContext.java
src/main/java/com/gitblit/transport/ssh/SshCommandFactory.java
src/main/java/com/gitblit/transport/ssh/commands/BaseCommand.java

index de79dacc35706f09f124ad017321a68ae6d3a712..163d07958029c07bdd3f42f01cff5fc775be6d85 100644 (file)
  */
 package com.gitblit.transport.ssh;
 
+import com.gitblit.manager.IGitblit;
+
 public class SshCommandContext {
 
+       private final IGitblit gitblit;
        private final SshDaemonClient client;
        private final String commandLine;
 
-       public SshCommandContext(SshDaemonClient client, String commandLine) {
+       public SshCommandContext(IGitblit gitblit, SshDaemonClient client, String commandLine) {
+               this.gitblit = gitblit;
                this.client = client;
                this.commandLine = commandLine;
        }
 
+       public IGitblit getGitblit() {
+               return gitblit;
+       }
+
        public SshDaemonClient getClient() {
                return client;
        }
index 48e8869af63f335a9d532048ea30d6b9cfe42d27..df288db00c9ddc053c3dbe18bb0fe885162ec827 100644 (file)
@@ -107,7 +107,7 @@ public class SshCommandFactory implements CommandFactory {
                root.setReceivePackFactory(new GitblitReceivePackFactory<SshDaemonClient>(gitblit));
                root.setAuthenticator(keyAuthenticator);
 
-               root.setContext(new SshCommandContext(client, cmdLine));
+               root.setContext(new SshCommandContext(gitblit, client, cmdLine));
 
                return root;
        }
index 28dfbdd0100ea155af2ad247d2a473969cb954a9..fb2d369fd06cef6ed87dfabbf229a70ab13c005d 100644 (file)
@@ -87,6 +87,7 @@ public abstract class BaseCommand implements Command, SessionAware {
 
        @Override
        public void destroy() {
+               ctx = null;
        }
 
        protected static PrintWriter toPrintWriter(final OutputStream o) {