Commit acc0d80c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Do not add deletion entry for rename destination.

parent 7d4c2306
...@@ -93,7 +93,6 @@ func (me *MemUnionFs) Reap() map[string]*Result { ...@@ -93,7 +93,6 @@ func (me *MemUnionFs) Reap() map[string]*Result {
m := map[string]*Result{} m := map[string]*Result{}
for name, _ := range me.deleted { for name, _ := range me.deleted {
fi, code := me.readonly.GetAttr(name, nil) fi, code := me.readonly.GetAttr(name, nil)
if !code.Ok() { if !code.Ok() {
continue continue
...@@ -120,7 +119,7 @@ func (me *MemUnionFs) Reap() map[string]*Result { ...@@ -120,7 +119,7 @@ func (me *MemUnionFs) Reap() map[string]*Result {
} }
} }
me.root.Reap("", m) me.root.reap("", m)
return m return m
} }
...@@ -379,14 +378,10 @@ func (me *memNode) Rename(oldName string, newParent fuse.FsNode, newName string, ...@@ -379,14 +378,10 @@ func (me *memNode) Rename(oldName string, newParent fuse.FsNode, newName string,
me.fs.deleted[filepath.Join(me.original, oldName)] = true me.fs.deleted[filepath.Join(me.original, oldName)] = true
} }
mn := ch.FsNode().(*memNode) childNode := ch.FsNode().(*memNode)
if mn.original != "" || mn == me.fs.root { if childNode.original != "" || childNode == me.fs.root {
if newParent.(*memNode).original != "" { childNode.materialize()
me.fs.deleted[filepath.Join(newParent.(*memNode).original, newName)] = true childNode.markChanged()
}
mn.materialize()
mn.markChanged()
} }
newParent.Inode().RmChild(newName) newParent.Inode().RmChild(newName)
...@@ -617,7 +612,7 @@ func (me *memNode) OpenDir(context *fuse.Context) (stream chan fuse.DirEntry, co ...@@ -617,7 +612,7 @@ func (me *memNode) OpenDir(context *fuse.Context) (stream chan fuse.DirEntry, co
return stream, fuse.OK return stream, fuse.OK
} }
func (me *memNode) Reap(path string, results map[string]*Result) { func (me *memNode) reap(path string, results map[string]*Result) {
if me.changed { if me.changed {
info := me.info info := me.info
results[path] = &Result{ results[path] = &Result{
...@@ -630,7 +625,7 @@ func (me *memNode) Reap(path string, results map[string]*Result) { ...@@ -630,7 +625,7 @@ func (me *memNode) Reap(path string, results map[string]*Result) {
for n, ch := range me.Inode().FsChildren() { for n, ch := range me.Inode().FsChildren() {
p := filepath.Join(path, n) p := filepath.Join(path, n)
ch.FsNode().(*memNode).Reap(p, results) ch.FsNode().(*memNode).reap(p, results)
} }
} }
......
...@@ -883,7 +883,6 @@ func TestMemUnionResetDirEntry(t *testing.T) { ...@@ -883,7 +883,6 @@ func TestMemUnionResetDirEntry(t *testing.T) {
clearInodes(after) clearInodes(after)
testEq(t, fuse.OsFileInfos(after), fuse.OsFileInfos(before), false) testEq(t, fuse.OsFileInfos(after), fuse.OsFileInfos(before), false)
ufs.Reset() ufs.Reset()
log.Println("reseT")
reset, _ := ioutil.ReadDir(wd + "/mnt/dir") reset, _ := ioutil.ReadDir(wd + "/mnt/dir")
clearInodes(reset) clearInodes(reset)
testEq(t, fuse.OsFileInfos(reset), fuse.OsFileInfos(before), true) testEq(t, fuse.OsFileInfos(reset), fuse.OsFileInfos(before), true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment