Skip to content

Commit

Permalink
Skipping windows
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Bustamante <[email protected]>
  • Loading branch information
jjbustamante committed Sep 11, 2023
1 parent 5779210 commit f7c6c6e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
13 changes: 0 additions & 13 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io/fs"
"os"
"path/filepath"
"syscall"
"time"

"github.com/docker/docker/pkg/ioutils"
Expand Down Expand Up @@ -429,18 +428,6 @@ func hasModeSocket(fi os.FileInfo) fs.FileMode {
return fi.Mode() & os.ModeSocket
}

func hasHardlinks(fi os.FileInfo) bool {
return fi.Sys().(*syscall.Stat_t).Nlink > 1
}

func getInodeFromStat(stat interface{}) (inode uint64, err error) {
s, ok := stat.(*syscall.Stat_t)
if ok {
inode = s.Ino
}
return
}

func writeRootHeader(tw TarWriter, basePath string, mode int64, uid int, gid int, normalizeModTime bool) error {
rootHeader := &tar.Header{
Typeflag: tar.TypeDir,
Expand Down
1 change: 1 addition & 0 deletions pkg/archive/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ func testArchive(t *testing.T, when spec.G, it spec.S) {

when("hard link files are present", func() {
it.Before(func() {
h.SkipIf(t, runtime.GOOS == "windows", "Skipping on windows")
src = filepath.Join("testdata", "dir-to-tar-with-hardlink")
// create a hard link
err := os.Link(filepath.Join(src, "original-file"), filepath.Join(src, "original-file-2"))
Expand Down
18 changes: 18 additions & 0 deletions pkg/archive/archive_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package archive

import (
"os"
"syscall"
)

func hasHardlinks(fi os.FileInfo) bool {
return fi.Sys().(*syscall.Stat_t).Nlink > 1
}

func getInodeFromStat(stat interface{}) (inode uint64, err error) {
s, ok := stat.(*syscall.Stat_t)
if ok {
inode = s.Ino
}
return
}
13 changes: 13 additions & 0 deletions pkg/archive/archive_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package archive

import (
"os"
)

func hasHardlinks(fi os.FileInfo) bool {
return false
}

func getInodeFromStat(stat interface{}) (inode uint64, err error) {
return
}
1 change: 1 addition & 0 deletions pkg/buildpack/buildpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ version = "1.2.3"
var bpRootFolder string

it.Before(func() {
h.SkipIf(t, runtime.GOOS == "windows", "Skipping on windows")
bpRootFolder = filepath.Join("testdata", "buildpack-with-hardlink")
// create a hard link
err := os.Link(filepath.Join(bpRootFolder, "original-file"), filepath.Join(bpRootFolder, "original-file-2"))
Expand Down

0 comments on commit f7c6c6e

Please sign in to comment.