Improvements to deletion

This commit is contained in:
Alex Yatskov 2015-06-22 13:09:22 +09:00
parent 95288801e9
commit c4323d28dc

16
dir.go
View File

@ -114,18 +114,14 @@ func (vd *verDir) removeDir(name string) error {
}
node := vd.dirs[name].node
ver := node.ver
if node.flags&NodeFlagNew == NodeFlagNew {
if err := os.Remove(node.rebasedPath()); err != nil {
return err
}
ver = ver.parent
}
if ver != nil {
ver.meta.removeNode(node.path)
if node.parent != nil {
vd.node.ver.meta.removeNode(node.path)
}
delete(vd.dirs, name)
@ -138,18 +134,14 @@ func (vd *verDir) removeFile(name string) error {
}
node := vd.files[name].node
ver := node.ver
if node.flags&NodeFlagNew == NodeFlagNew {
if err := os.Remove(node.rebasedPath()); err != nil {
return err
}
ver = ver.parent
}
if ver != nil {
ver.meta.removeNode(node.path)
if node.parent != nil {
vd.node.ver.meta.removeNode(node.path)
}
delete(vd.files, name)