You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
728 B
35 lines
728 B
// +build windows
|
|
|
|
package git
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
|
|
"gopkg.in/src-d/go-git.v4/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
|
|
}
|
|
|