aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/ssh/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/transport/ssh/common.go')
-rw-r--r--plumbing/transport/ssh/common.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/plumbing/transport/ssh/common.go b/plumbing/transport/ssh/common.go
index 6d1c51b..af79dfb 100644
--- a/plumbing/transport/ssh/common.go
+++ b/plumbing/transport/ssh/common.go
@@ -146,11 +146,14 @@ func overrideConfig(overrides *ssh.ClientConfig, c *ssh.ClientConfig) {
return
}
- vo := reflect.ValueOf(*overrides)
- vc := reflect.ValueOf(*c)
- for i := 0; i < vc.Type().NumField(); i++ {
- vcf := vc.Field(i)
- vof := vo.Field(i)
+ t := reflect.TypeOf(*c)
+ vc := reflect.ValueOf(c).Elem()
+ vo := reflect.ValueOf(overrides).Elem()
+
+ for i := 0; i < t.NumField(); i++ {
+ f := t.Field(i)
+ vcf := vc.FieldByName(f.Name)
+ vof := vo.FieldByName(f.Name)
if isZeroValue(vcf) {
vcf.Set(vof)
}