aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/src-d/go-git.v4/worktree_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/src-d/go-git.v4/worktree_windows.go')
-rw-r--r--vendor/gopkg.in/src-d/go-git.v4/worktree_windows.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/gopkg.in/src-d/go-git.v4/worktree_windows.go b/vendor/gopkg.in/src-d/go-git.v4/worktree_windows.go
new file mode 100644
index 0000000000..1bef6f759c
--- /dev/null
+++ b/vendor/gopkg.in/src-d/go-git.v4/worktree_windows.go
@@ -0,0 +1,35 @@
+// +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
+}