public void Dispose()
 {
     if (repository != null)
     {
         repository.Close();
     }
 }
예제 #2
0
 public static void UpdateDates()
 {
     _repository = GetRepository();
     _git        = new Git(_repository);
     UpdateDatesInternal();
     _repository.Close();
 }
예제 #3
0
            /// <exception cref="NGit.Errors.TransportException"></exception>
            public InternalLocalFetchConnection(TransportLocal _enclosing) : base(_enclosing
                                                                                  )
            {
                this._enclosing = _enclosing;
                Repository dst;

                try
                {
                    dst = new FileRepository(this._enclosing.remoteGitDir);
                }
                catch (IOException)
                {
                    throw new TransportException(this.uri, JGitText.Get().notAGitDirectory);
                }
                PipedInputStream  in_r;
                PipedOutputStream in_w;
                PipedInputStream  out_r;
                PipedOutputStream out_w;

                try
                {
                    in_r  = new PipedInputStream();
                    in_w  = new PipedOutputStream(in_r);
                    out_r = new _PipedInputStream_193();
                    // The client (BasePackFetchConnection) can write
                    // a huge burst before it reads again. We need to
                    // force the buffer to be big enough, otherwise it
                    // will deadlock both threads.
                    out_w = new PipedOutputStream(out_r);
                }
                catch (IOException err)
                {
                    dst.Close();
                    throw new TransportException(this.uri, JGitText.Get().cannotConnectPipes, err);
                }
                this.worker = new _Thread_208(this, dst, out_r, in_w, "JGit-Upload-Pack");
                // Client side of the pipes should report the problem.
                // Clients side will notice we went away, and report.
                // Ignore close failure, we probably crashed above.
                // Ignore close failure, we probably crashed above.
                this.worker.Start();
                this.Init(in_r, out_w);
                this.ReadAdvertisedRefs();
            }
예제 #4
0
            /// <exception cref="NGit.Errors.TransportException"></exception>
            public InternalLocalPushConnection(TransportLocal _enclosing) : base(_enclosing
                                                                                 )
            {
                this._enclosing = _enclosing;
                Repository dst;

                try
                {
                    dst = new FileRepository(this._enclosing.remoteGitDir);
                }
                catch (IOException)
                {
                    throw new TransportException(this.uri, JGitText.Get().notAGitDirectory);
                }
                PipedInputStream  in_r;
                PipedOutputStream in_w;
                PipedInputStream  out_r;
                PipedOutputStream out_w;

                try
                {
                    in_r  = new PipedInputStream();
                    in_w  = new PipedOutputStream(in_r);
                    out_r = new PipedInputStream();
                    out_w = new PipedOutputStream(out_r);
                }
                catch (IOException err)
                {
                    dst.Close();
                    throw new TransportException(this.uri, JGitText.Get().cannotConnectPipes, err);
                }
                this.worker = new _Thread_340(this, dst, out_r, in_w, "JGit-Receive-Pack");
                // Client side of the pipes should report the problem.
                // Clients side will notice we went away, and report.
                // Ignore close failure, we probably crashed above.
                // Ignore close failure, we probably crashed above.
                this.worker.Start();
                this.Init(in_r, out_w);
                this.ReadAdvertisedRefs();
            }