Skip to content

Commit

Permalink
lfsapi/lfsapi.go: enhance trace logs
Browse files Browse the repository at this point in the history
Since PR git-lfs#4446 we have output several trace log messages when attempting
to instantiate a new SSHTransfer structure in the SSHTransfer() method
of the Client structure in our "lfsapi" package.  This method takes
"operation" and "remote" string arguments, and the returned SSHTransfer
structure is specific to those values.

As we may potentially call this method several times in a single
process, with different arguments, we add the "operation" and "remote"
variables to our trace log messages, which will help us when we analyze
logs and want to distinguish the different contexts in which the
SSHTransfer() method was called.
  • Loading branch information
chrisd8088 committed Nov 1, 2024
1 parent fb68c2b commit 14b79f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lfsapi/lfsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ func (c *Client) SSHTransfer(operation, remote string) *ssh.SSHTransfer {
}
uc := config.NewURLConfig(c.context.GitEnv())
if val, ok := uc.Get("lfs", endpoint.OriginalUrl, "sshtransfer"); ok && val != "negotiate" && val != "always" {
tracerx.Printf("skipping pure SSH protocol connection by request")
tracerx.Printf("skipping pure SSH protocol connection by request (%s, %s)", operation, remote)
return nil
}
ctx := c.Context()
tracerx.Printf("attempting pure SSH protocol connection")
tracerx.Printf("attempting pure SSH protocol connection (%s, %s)", operation, remote)
sshTransfer, err := ssh.NewSSHTransfer(ctx.OSEnv(), ctx.GitEnv(), &endpoint.SSHMetadata, operation)
if err != nil {
tracerx.Printf("pure SSH protocol connection failed: %s", err)
tracerx.Printf("pure SSH protocol connection failed (%s, %s): %s", operation, remote, err)
return nil
}
return sshTransfer
Expand Down

0 comments on commit 14b79f4

Please sign in to comment.