fork of go-git with some jj specific features
at main 731 B view raw
1// +build windows 2 3package git 4 5import ( 6 "os" 7 "syscall" 8 "time" 9 10 "github.com/go-git/go-git/v5/plumbing/format/index" 11) 12 13func init() { 14 fillSystemInfo = func(e *index.Entry, sys interface{}) { 15 if os, ok := sys.(*syscall.Win32FileAttributeData); ok { 16 seconds := os.CreationTime.Nanoseconds() / 1000000000 17 nanoseconds := os.CreationTime.Nanoseconds() - seconds*1000000000 18 e.CreatedAt = time.Unix(seconds, nanoseconds) 19 } 20 } 21} 22 23func isSymlinkWindowsNonAdmin(err error) bool { 24 const ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 25 26 if err != nil { 27 if errLink, ok := err.(*os.LinkError); ok { 28 if errNo, ok := errLink.Err.(syscall.Errno); ok { 29 return errNo == ERROR_PRIVILEGE_NOT_HELD 30 } 31 } 32 } 33 34 return false 35}