Skip to content

Commit 8f419dd

Browse files
committed
tar: add GNU header
1 parent fc8400a commit 8f419dd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tar.go

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ func init() {
1616
}
1717

1818
type Tar struct {
19+
// If true, use GNU header format
20+
GNU bool
21+
1922
// If true, preserve only numeric user and group id
2023
NumericUIDGID bool
2124

@@ -87,6 +90,9 @@ func (t Tar) writeFileToArchive(ctx context.Context, tw *tar.Writer, file FileIn
8790
if hdr.Name == "" {
8891
hdr.Name = file.Name() // assume base name of file I guess
8992
}
93+
if t.GNU {
94+
hdr.Format = tar.FormatGNU
95+
}
9096
if t.NumericUIDGID {
9197
hdr.Uname = ""
9298
hdr.Gname = ""

0 commit comments

Comments
 (0)