aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/ssh/common.go
diff options
context:
space:
mode:
authorDavid Cuadrado <krawek@gmail.com>2021-03-26 11:02:47 -0500
committerGitHub <noreply@github.com>2021-03-26 17:02:47 +0100
commit1f328388192915476c68e5e0c8c1c818fd50fc6b (patch)
tree7df158c886cb51c10f0d4ba1814bd198d07d255e /plumbing/transport/ssh/common.go
parentbf3471db54b0255ab5b159005069f37528a151b7 (diff)
downloadgo-git-1f328388192915476c68e5e0c8c1c818fd50fc6b.tar.gz
transport: ssh, fix cloning large repositories (#272)
* Fix cloning large repositories Ignore the error on close when the connection is already closed Fixes #70 * Compatibility for go 1.13 Because it's required by the pipeline * Add test for allowing to close a command when the client is already closed This test is for issue #70 * Add debug information for broken test
Diffstat (limited to 'plumbing/transport/ssh/common.go')
-rw-r--r--plumbing/transport/ssh/common.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/plumbing/transport/ssh/common.go b/plumbing/transport/ssh/common.go
index c05ded9..46e7913 100644
--- a/plumbing/transport/ssh/common.go
+++ b/plumbing/transport/ssh/common.go
@@ -6,6 +6,7 @@ import (
"fmt"
"reflect"
"strconv"
+ "strings"
"github.com/go-git/go-git/v5/plumbing/transport"
"github.com/go-git/go-git/v5/plumbing/transport/internal/common"
@@ -90,8 +91,14 @@ func (c *command) Close() error {
//XXX: If did read the full packfile, then the session might be already
// closed.
_ = c.Session.Close()
+ err := c.client.Close()
- return c.client.Close()
+ //XXX: in go1.16+ we can use errors.Is(err, net.ErrClosed)
+ if err != nil && strings.HasSuffix(err.Error(), "use of closed network connection") {
+ return nil
+ }
+
+ return err
}
// connect connects to the SSH server, unless a AuthMethod was set with