Skip to content

Commit cffb28d

Browse files
committed
Set SSH verbosity based on git-sync -v value
1 parent 8b861d9 commit cffb28d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

main.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ func main() {
764764

765765
// If the --repo or any submodule uses SSH, we need to know which keys.
766766
if err := git.SetupGitSSH(*flSSHKnownHosts, *flSSHKeyFiles, *flSSHKnownHostsFile); err != nil {
767-
log.Error(err, "can't set up git SSH", "keyFile", *flSSHKeyFiles, "knownHosts", *flSSHKnownHosts, "knownHostsFile", *flSSHKnownHostsFile)
767+
log.Error(err, "can't set up git SSH", "keyFiles", *flSSHKeyFiles, "useKnownHosts", *flSSHKnownHosts, "knownHostsFile", *flSSHKnownHostsFile)
768768
os.Exit(1)
769769
}
770770

@@ -1912,6 +1912,18 @@ func (git *repoSync) SetupGitSSH(setupKnownHosts bool, pathsToSSHSecrets []strin
19121912
sshCmd = "ssh"
19131913
}
19141914

1915+
// We can't pre-verify that key-files exist because we call this path
1916+
// without knowing whether we actually need SSH or not, in which case the
1917+
// files may not exist and that is OK. But we can make SSH report more.
1918+
switch {
1919+
case git.log.V(9).Enabled():
1920+
sshCmd += " -vvv"
1921+
case git.log.V(7).Enabled():
1922+
sshCmd += " -vv"
1923+
case git.log.V(5).Enabled():
1924+
sshCmd += " -v"
1925+
}
1926+
19151927
for _, p := range pathsToSSHSecrets {
19161928
sshCmd += fmt.Sprintf(" -i %s", p)
19171929
}

0 commit comments

Comments
 (0)