mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-26 01:55:39 +00:00
tar: remove completed TODO's and dead code
minor clean-up of some comments and code that is not used in tar functionality Signed-off-by: Stephen Chung <spchung@andrew.cmu.edu>
This commit is contained in:
parent
bc52946f8e
commit
3973da9b81
1 changed files with 0 additions and 27 deletions
27
tar.go
27
tar.go
|
@ -145,7 +145,6 @@ func (ts *tarStream) readHeaders() {
|
||||||
if hdr.FileInfo().IsDir() && keyword == "size" {
|
if hdr.FileInfo().IsDir() && keyword == "size" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// TODO: handle hardlinks
|
|
||||||
val, err := keyFunc(hdr.Name, hdr.FileInfo(), tmpFile)
|
val, err := keyFunc(hdr.Name, hdr.FileInfo(), tmpFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ts.setErr(err)
|
ts.setErr(err)
|
||||||
|
@ -218,13 +217,11 @@ func populateTree(root, e *Entry, hdr *tar.Header) error {
|
||||||
// directory up until the actual file
|
// directory up until the actual file
|
||||||
wd = filepath.Dir(wd)
|
wd = filepath.Dir(wd)
|
||||||
if wd == "." {
|
if wd == "." {
|
||||||
// If file in root directory, no need to traverse down, just append
|
|
||||||
root.Children = append([]*Entry{e}, root.Children...)
|
root.Children = append([]*Entry{e}, root.Children...)
|
||||||
e.Parent = root
|
e.Parent = root
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: what about directory/file names with "/" in it?
|
|
||||||
dirNames := strings.Split(wd, "/")
|
dirNames := strings.Split(wd, "/")
|
||||||
parent := root
|
parent := root
|
||||||
for _, name := range dirNames[:] {
|
for _, name := range dirNames[:] {
|
||||||
|
@ -422,30 +419,6 @@ func setDifference(this, that []string) []string {
|
||||||
return diff
|
return diff
|
||||||
}
|
}
|
||||||
|
|
||||||
type relationship int
|
|
||||||
|
|
||||||
const (
|
|
||||||
unknownDir relationship = iota
|
|
||||||
sameDir
|
|
||||||
childDir
|
|
||||||
parentDir
|
|
||||||
)
|
|
||||||
|
|
||||||
func compareDir(curDir, prevDir string) relationship {
|
|
||||||
curDir = filepath.Clean(curDir)
|
|
||||||
prevDir = filepath.Clean(prevDir)
|
|
||||||
if curDir == prevDir {
|
|
||||||
return sameDir
|
|
||||||
}
|
|
||||||
if filepath.Dir(curDir) == prevDir {
|
|
||||||
return childDir
|
|
||||||
}
|
|
||||||
if curDir == filepath.Dir(prevDir) {
|
|
||||||
return parentDir
|
|
||||||
}
|
|
||||||
return unknownDir
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ts *tarStream) setErr(err error) {
|
func (ts *tarStream) setErr(err error) {
|
||||||
ts.err = err
|
ts.err = err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue