Skip to content

Commit

Permalink
tar: add GNU header
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Jan 7, 2025
1 parent fc8400a commit 8f419dd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ func init() {
}

type Tar struct {
// If true, use GNU header format
GNU bool

// If true, preserve only numeric user and group id
NumericUIDGID bool

Expand Down Expand Up @@ -87,6 +90,9 @@ func (t Tar) writeFileToArchive(ctx context.Context, tw *tar.Writer, file FileIn
if hdr.Name == "" {
hdr.Name = file.Name() // assume base name of file I guess
}
if t.GNU {
hdr.Format = tar.FormatGNU
}
if t.NumericUIDGID {
hdr.Uname = ""
hdr.Gname = ""
Expand Down

0 comments on commit 8f419dd

Please sign in to comment.