本站源代码
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.

36 lines
728B

  1. // +build windows
  2. package git
  3. import (
  4. "os"
  5. "syscall"
  6. "time"
  7. "gopkg.in/src-d/go-git.v4/plumbing/format/index"
  8. )
  9. func init() {
  10. fillSystemInfo = func(e *index.Entry, sys interface{}) {
  11. if os, ok := sys.(*syscall.Win32FileAttributeData); ok {
  12. seconds := os.CreationTime.Nanoseconds() / 1000000000
  13. nanoseconds := os.CreationTime.Nanoseconds() - seconds*1000000000
  14. e.CreatedAt = time.Unix(seconds, nanoseconds)
  15. }
  16. }
  17. }
  18. func isSymlinkWindowsNonAdmin(err error) bool {
  19. const ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314
  20. if err != nil {
  21. if errLink, ok := err.(*os.LinkError); ok {
  22. if errNo, ok := errLink.Err.(syscall.Errno); ok {
  23. return errNo == ERROR_PRIVILEGE_NOT_HELD
  24. }
  25. }
  26. }
  27. return false
  28. }
上海开阖软件有限公司 沪ICP备12045867号-1