From 0f5aaf5f5331a191341e702977564aa6454400a1 Mon Sep 17 00:00:00 2001 From: Christian Stewart Date: Tue, 3 Aug 2021 18:01:49 -0700 Subject: [PATCH 1/2] gitignore: add vendor and .tmp ignores Signed-off-by: Christian Stewart --- .gitignore | 3 ++- plumbing/format/packfile/.gitignore | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 plumbing/format/packfile/.gitignore diff --git a/.gitignore b/.gitignore index e8d25f548..5890ceb59 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ coverage.out *~ coverage.txt profile.out -.tmp/ \ No newline at end of file +/vendor +/.tmp diff --git a/plumbing/format/packfile/.gitignore b/plumbing/format/packfile/.gitignore new file mode 100644 index 000000000..c709af0b5 --- /dev/null +++ b/plumbing/format/packfile/.gitignore @@ -0,0 +1 @@ +/.tmp \ No newline at end of file From b641fd8f849b2664ea4b688775a204357003dc65 Mon Sep 17 00:00:00 2001 From: Christian Stewart Date: Tue, 3 Aug 2021 18:16:37 -0700 Subject: [PATCH 2/2] fix(worktree): add support for gopherjs build Adds a separate build file for wasm and gopherjs environments. Issues filed relating to no "gopherjs" tag being set - requiring the more awkward "js,!wasm" condition, as well as the os.Ctime incompatibility: - https://github.com/gopherjs/gopherjs/issues/1047 - https://github.com/gopherjs/gopherjs/issues/1046 Now the "gopherjs build -v" command works in this repository. Signed-off-by: Christian Stewart --- worktree_gopherjs.go | 26 ++++++++++++++++++++++++++ worktree_linux.go | 2 +- worktree_js.go => worktree_wasm.go | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 worktree_gopherjs.go rename worktree_js.go => worktree_wasm.go (96%) diff --git a/worktree_gopherjs.go b/worktree_gopherjs.go new file mode 100644 index 000000000..d3d0683ba --- /dev/null +++ b/worktree_gopherjs.go @@ -0,0 +1,26 @@ +// +build js,!wasm + +package git + +import ( + "syscall" + + "github.com/go-git/go-git/v5/plumbing/format/index" +) + +func init() { + fillSystemInfo = func(e *index.Entry, sys interface{}) { + if os, ok := sys.(*syscall.Stat_t); ok { + // not supported on gopherjs: + // e.CreatedAt = time.Unix(int64(os.Ctime), int64(os.CtimeNsec)) + e.Dev = uint32(os.Dev) + e.Inode = uint32(os.Ino) + e.GID = os.Gid + e.UID = os.Uid + } + } +} + +func isSymlinkWindowsNonAdmin(err error) bool { + return false +} diff --git a/worktree_linux.go b/worktree_linux.go index 6fcace2f9..f7b22545c 100644 --- a/worktree_linux.go +++ b/worktree_linux.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,!js package git diff --git a/worktree_js.go b/worktree_wasm.go similarity index 96% rename from worktree_js.go rename to worktree_wasm.go index 7267d055e..d55d49847 100644 --- a/worktree_js.go +++ b/worktree_wasm.go @@ -1,4 +1,4 @@ -// +build js +// +build js,wasm package git