1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-07-04 06:38:30 +00:00

tar: populate Entry tree under a common root

Resolves #56. Now, the Entry tree will be populated
under a common root (if necessary), so that a manifest can
be accurately generate from a tar file that has been
created using multiple directories.

Signed-off-by: Stephen Chung <schung@redhat.com>
This commit is contained in:
Stephen Chung 2016-08-02 15:30:45 -04:00
parent 6a37331074
commit 3d6b74d6f7
22 changed files with 287 additions and 91 deletions

View file

@ -42,7 +42,6 @@ func Check(root string, dh *DirectoryHierarchy, keywords []string) (*Result, err
return nil, err
}
sort.Sort(byPos(creator.DH.Entries))
var result Result
for i, e := range creator.DH.Entries {
switch e.Type {
@ -118,6 +117,9 @@ func TarCheck(tarDH, dh *DirectoryHierarchy, keywords []string) (*Result, error)
break
}
}
if tarRoot == nil {
return nil, fmt.Errorf("root of archive could not be found")
}
tarRoot.Next = &Entry{
Name: "seen",
Type: CommentType,