Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions fs/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ func TestManifestFromDir(t *testing.T) {
actual.root.items["s"].(*directory).items["k"].(*file).content.Close()
}

func TestSymlinks(t *testing.T) {
rootDirectory := NewDir(t, "root",
WithFile("foo.txt", "foo"),
WithSymlink("foo.link", "foo.txt"))
defer rootDirectory.Remove()
expected := Expected(t,
WithFile("foo.txt", "foo"),
WithSymlink("foo.link", rootDirectory.Join("foo.txt")))
assert.Assert(t, Equal(rootDirectory.Path(), expected))
}

var cmpManifest = cmp.Options{
cmp.AllowUnexported(Manifest{}, resource{}, file{}, symlink{}, directory{}),
cmp.Comparer(func(x, y io.ReadCloser) bool {
Expand Down
16 changes: 12 additions & 4 deletions fs/manifest_unix.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
//go:build !windows
// +build !windows

package fs

import (
"os"
"runtime"
"syscall"
)

const (
defaultRootDirMode = os.ModeDir | 0700
defaultSymlinkMode = os.ModeSymlink | 0777
)
const defaultRootDirMode = os.ModeDir | 0700

var defaultSymlinkMode = os.ModeSymlink | 0777

func init() {
switch runtime.GOOS {
case "darwin":
defaultSymlinkMode = os.ModeSymlink | 0755
}
}

func newResourceFromInfo(info os.FileInfo) resource {
statT := info.Sys().(*syscall.Stat_t)
Expand Down