*: have gomtree always evaluate tar_time if it is present
if the keyword "tar_time" is present when evaluating an Entry, gomtree should use the tar_time when evaluating the "time" keyword as well. This commit also adds a test that makes sure "tar_time" wins against "time" if both are present. Some minor clean-ups as well, such as checking if KeywordFunc[keyword] actually retrieves a function. Signed-off-by: Stephen Chung <schung@redhat.com>
This commit is contained in:
parent
bc6f3bf902
commit
656e577ecc
7 changed files with 106 additions and 25 deletions
7
tar.go
7
tar.go
|
@ -93,6 +93,8 @@ func (ts *tarStream) readHeaders() {
|
|||
ts.pipeReader.CloseWithError(err)
|
||||
return
|
||||
}
|
||||
defer tmpFile.Close()
|
||||
defer os.Remove(tmpFile.Name())
|
||||
|
||||
// Alright, it's either file or directory
|
||||
e := Entry{
|
||||
|
@ -119,7 +121,6 @@ func (ts *tarStream) readHeaders() {
|
|||
if err != nil {
|
||||
ts.setErr(err)
|
||||
}
|
||||
|
||||
// for good measure, check that we actually get a value for a keyword
|
||||
if val != "" {
|
||||
e.Keywords = append(e.Keywords, val)
|
||||
|
@ -134,7 +135,6 @@ func (ts *tarStream) readHeaders() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// collect meta-set keywords for a directory so that we can build the
|
||||
// actual sets in `flatten`
|
||||
if hdr.FileInfo().IsDir() {
|
||||
|
@ -168,9 +168,6 @@ func (ts *tarStream) readHeaders() {
|
|||
}
|
||||
}
|
||||
populateTree(&root, &e, hdr, ts)
|
||||
|
||||
tmpFile.Close()
|
||||
os.Remove(tmpFile.Name())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue