mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
Bump go-git
This commit is contained in:
2
vendor/github.com/xanzy/ssh-agent/README.md
generated
vendored
2
vendor/github.com/xanzy/ssh-agent/README.md
generated
vendored
@ -16,7 +16,7 @@ If you have an issue: report it on the [issue tracker](https://github.com/xanzy/
|
||||
|
||||
## Author
|
||||
|
||||
Sander van Harmelen (<sander@xanzy.io>)
|
||||
Sander van Harmelen (<sander@vanharmelen.nl>)
|
||||
|
||||
## License
|
||||
|
||||
|
19
vendor/github.com/xanzy/ssh-agent/pageant_windows.go
generated
vendored
19
vendor/github.com/xanzy/ssh-agent/pageant_windows.go
generated
vendored
@ -17,6 +17,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package sshagent
|
||||
@ -31,6 +32,8 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// Maximum size of message can be sent to pageant
|
||||
@ -59,19 +62,19 @@ type copyData struct {
|
||||
var (
|
||||
lock sync.Mutex
|
||||
|
||||
winFindWindow = winAPI("user32.dll", "FindWindowW")
|
||||
winGetCurrentThreadID = winAPI("kernel32.dll", "GetCurrentThreadId")
|
||||
winSendMessage = winAPI("user32.dll", "SendMessageW")
|
||||
user32dll = windows.NewLazySystemDLL("user32.dll")
|
||||
winFindWindow = winAPI(user32dll, "FindWindowW")
|
||||
winSendMessage = winAPI(user32dll, "SendMessageW")
|
||||
|
||||
kernel32dll = windows.NewLazySystemDLL("kernel32.dll")
|
||||
winGetCurrentThreadID = winAPI(kernel32dll, "GetCurrentThreadId")
|
||||
)
|
||||
|
||||
func winAPI(dllName, funcName string) func(...uintptr) (uintptr, uintptr, error) {
|
||||
proc := syscall.MustLoadDLL(dllName).MustFindProc(funcName)
|
||||
func winAPI(dll *windows.LazyDLL, funcName string) func(...uintptr) (uintptr, uintptr, error) {
|
||||
proc := dll.NewProc(funcName)
|
||||
return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) }
|
||||
}
|
||||
|
||||
// Available returns true if Pageant is running
|
||||
func Available() bool { return pageantWindow() != 0 }
|
||||
|
||||
// Query sends message msg to Pageant and returns response or error.
|
||||
// 'msg' is raw agent request with length prefix
|
||||
// Response is raw agent response with length prefix
|
||||
|
1
vendor/github.com/xanzy/ssh-agent/sshagent.go
generated
vendored
1
vendor/github.com/xanzy/ssh-agent/sshagent.go
generated
vendored
@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package sshagent
|
||||
|
32
vendor/github.com/xanzy/ssh-agent/sshagent_windows.go
generated
vendored
32
vendor/github.com/xanzy/ssh-agent/sshagent_windows.go
generated
vendored
@ -17,6 +17,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package sshagent
|
||||
@ -27,17 +28,40 @@ import (
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
"golang.org/x/crypto/ssh/agent"
|
||||
)
|
||||
|
||||
const (
|
||||
sshAgentPipe = `\\.\pipe\openssh-ssh-agent`
|
||||
)
|
||||
|
||||
// Available returns true if Pageant is running
|
||||
func Available() bool {
|
||||
if pageantWindow() != 0 {
|
||||
return true
|
||||
}
|
||||
conn, err := winio.DialPipe(sshAgentPipe, nil)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
conn.Close()
|
||||
return true
|
||||
}
|
||||
|
||||
// New returns a new agent.Agent and the (custom) connection it uses
|
||||
// to communicate with a running pagent.exe instance (see README.md)
|
||||
func New() (agent.Agent, net.Conn, error) {
|
||||
if !Available() {
|
||||
return nil, nil, errors.New("SSH agent requested but Pageant not running")
|
||||
if pageantWindow() != 0 {
|
||||
return agent.NewClient(&conn{}), nil, nil
|
||||
}
|
||||
|
||||
return agent.NewClient(&conn{}), nil, nil
|
||||
conn, err := winio.DialPipe(sshAgentPipe, nil)
|
||||
if err != nil {
|
||||
return nil, nil, errors.New(
|
||||
"SSH agent requested, but could not detect Pageant or Windows native SSH agent",
|
||||
)
|
||||
}
|
||||
return agent.NewClient(conn), nil, nil
|
||||
}
|
||||
|
||||
type conn struct {
|
||||
|
Reference in New Issue
Block a user