gitea-tea/vendor/github.com/go-git/go-git/v5/worktree_windows.go
6543 6cff3b1cc7 migrate src-d/go-git -> go-git/go-git (#128)
Merge branch 'master' into vendor-migrate-go-git

Merge branch 'master' into vendor-migrate-go-git

migrate src-d/go-git -> go-git/go-git

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/128
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-30 02:02:15 +00:00

36 lines
731 B
Go

// +build windows
package git
import (
"os"
"syscall"
"time"
"github.com/go-git/go-git/v5/plumbing/format/index"
)
func init() {
fillSystemInfo = func(e *index.Entry, sys interface{}) {
if os, ok := sys.(*syscall.Win32FileAttributeData); ok {
seconds := os.CreationTime.Nanoseconds() / 1000000000
nanoseconds := os.CreationTime.Nanoseconds() - seconds*1000000000
e.CreatedAt = time.Unix(seconds, nanoseconds)
}
}
}
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
}