diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-03-12 15:30:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-12 15:30:49 +0100 |
commit | 71e37414308043c18b9263ea8b18f296345b3e54 (patch) | |
tree | 9c39915df072451fbfde8da2367765797e50bafb /worktree_windows.go | |
parent | 1d28459504251497e0ce6132a0fadd5eb44ffd22 (diff) | |
parent | 4915f5834dbb588836ad787e728cf4a81364f5af (diff) | |
download | go-git-71e37414308043c18b9263ea8b18f296345b3e54.tar.gz |
Merge pull request #778 from konsorten/fix-windows-symlink3
Worktree.Checkout: handling of symlink on Windows
Diffstat (limited to 'worktree_windows.go')
-rw-r--r-- | worktree_windows.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/worktree_windows.go b/worktree_windows.go index d59448e..1bef6f7 100644 --- a/worktree_windows.go +++ b/worktree_windows.go @@ -3,6 +3,7 @@ package git import ( + "os" "syscall" "time" @@ -18,3 +19,17 @@ func init() { } } } + +func isSymlinkWindowsNonAdmin(err error) bool { + const ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 + + if err != nil { + if errLink, ok := err.(*os.LinkError); ok { + if errNo, ok := errLink.Err.(syscall.Errno); ok { + return errNo == ERROR_PRIVILEGE_NOT_HELD + } + } + } + + return false +} |