From 1675edbff5055189d958244b6e0ded9f5d37fe91 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Wed, 19 Jul 2017 00:09:39 +0200 Subject: worktree: fix file system info in windows --- worktree_windows.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 worktree_windows.go (limited to 'worktree_windows.go') diff --git a/worktree_windows.go b/worktree_windows.go new file mode 100644 index 0000000..d59448e --- /dev/null +++ b/worktree_windows.go @@ -0,0 +1,20 @@ +// +build windows + +package git + +import ( + "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) + } + } +} -- cgit