blob: 1928f9712e95ba754adf6d9a3fb67d91d4baf83a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// +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
}
|