Skip to content

Commit

Permalink
another try to implement method in
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Bustamante <[email protected]>
  • Loading branch information
jjbustamante committed Nov 9, 2023
1 parent fcd6814 commit a7dff35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion pkg/archive/archive_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ import (
)

func hasHardlinks(fi os.FileInfo) bool {
return fi.Sys().(*syscall.ByHandleFileInformation).NumberOfLinks > 1
// A hard link is the file-system representation of a file by which more than one path references a single file in the same volume.
switch v := fi.Sys().(type) {
case *syscall.Win32FileAttributeData:
return len(v.FileName) > 1
case *syscall.ByHandleFileInformation:
return v.NumberOfLinks > 1
case *syscall.Win32finddata:
return len(v.FileName) > 1
default:
return false
}
}

func getInodeFromStat(stat interface{}) (inode uint64, err error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/buildpack/buildpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ version = "1.2.3"
os.RemoveAll(filepath.Join(bpRootFolder, "original-file-2"))
})

it("hardlink is preserved in the output tar file", func() {
it.Focus("hardlink is preserved in the output tar file", func() {
bp, err := buildpack.FromBuildpackRootBlob(
blob.NewBlob(bpRootFolder),
archive.DefaultTarWriterFactory(),
Expand Down

0 comments on commit a7dff35

Please sign in to comment.