Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
b7c768d4
Commit
b7c768d4
authored
Jan 30, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unionfs: use early return for more idiomatic code in Rename()
parent
33c1cab5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
unionfs/unionfs.go
unionfs/unionfs.go
+19
-19
No files found.
unionfs/unionfs.go
View file @
b7c768d4
...
@@ -885,38 +885,38 @@ func (fs *unionFS) renameDirectory(srcResult branchResult, srcDir string, dstDir
...
@@ -885,38 +885,38 @@ func (fs *unionFS) renameDirectory(srcResult branchResult, srcDir string, dstDir
return
code
return
code
}
}
func
(
fs
*
unionFS
)
Rename
(
src
string
,
dst
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
unionFS
)
Rename
(
src
string
,
dst
string
,
context
*
fuse
.
Context
)
fuse
.
Status
{
srcResult
:=
fs
.
getBranch
(
src
)
srcResult
:=
fs
.
getBranch
(
src
)
code
=
srcResult
.
code
if
!
srcResult
.
code
.
Ok
()
{
if
code
.
Ok
()
{
return
srcResult
.
code
code
=
srcResult
.
code
}
}
if
srcResult
.
attr
.
IsDir
()
{
if
srcResult
.
attr
.
IsDir
()
{
return
fs
.
renameDirectory
(
srcResult
,
src
,
dst
,
context
)
return
fs
.
renameDirectory
(
srcResult
,
src
,
dst
,
context
)
}
}
if
code
.
Ok
()
&&
srcResult
.
branch
>
0
{
if
srcResult
.
branch
>
0
{
code
=
fs
.
Promote
(
src
,
srcResult
,
context
)
if
code
:=
fs
.
Promote
(
src
,
srcResult
,
context
);
!
code
.
Ok
()
{
return
code
}
}
}
if
code
.
Ok
()
{
if
code
:=
fs
.
promoteDirsTo
(
dst
);
!
code
.
Ok
()
{
code
=
fs
.
promoteDirsTo
(
dst
)
return
code
}
}
if
code
.
Ok
()
{
code
=
fs
.
fileSystems
[
0
]
.
Rename
(
src
,
dst
,
context
)
if
code
:=
fs
.
fileSystems
[
0
]
.
Rename
(
src
,
dst
,
context
);
!
code
.
Ok
()
{
return
code
}
}
if
code
.
Ok
()
{
fs
.
removeDeletion
(
dst
)
fs
.
removeDeletion
(
dst
)
// Rename is racy; avoid racing with unionFsFile.Release().
// Rename is racy; avoid racing with unionFsFile.Release().
fs
.
branchCache
.
DropEntry
(
dst
)
fs
.
branchCache
.
DropEntry
(
dst
)
srcResult
:=
fs
.
branchCache
.
GetFresh
(
src
)
srcResult
=
fs
.
branchCache
.
GetFresh
(
src
)
.
(
branchResult
)
if
srcResult
.
(
branchResult
)
.
branch
>
0
{
if
srcResult
.
branch
>
0
{
code
=
fs
.
putDeletion
(
src
)
return
fs
.
putDeletion
(
src
)
}
}
}
return
code
return
fuse
.
OK
}
}
func
(
fs
*
unionFS
)
DropBranchCache
(
names
[]
string
)
{
func
(
fs
*
unionFS
)
DropBranchCache
(
names
[]
string
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment