-
Notifications
You must be signed in to change notification settings - Fork 16
Prevent incorrect move #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Moving from a to b where a=b will caouse system.io.exception => job fails
@@ -175,7 +175,8 @@ public override void UpdateItem(EntryUpdateInfo updateInfo, SyncEntryChangedFlag | |||
else if (updateInfo.Entry.Type == SyncEntryType.Directory) | |||
{ | |||
Pre.Assert(!string.IsNullOrEmpty(newFullPath), "newFullPath != null"); | |||
Directory.Move(fullPath, newFullPath); | |||
if (fullPath != newFullPath) | |||
Directory.Move(fullPath, newFullPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add curly braces here? (common coding style)
@@ -175,7 +175,8 @@ public override void UpdateItem(EntryUpdateInfo updateInfo, SyncEntryChangedFlag | |||
else if (updateInfo.Entry.Type == SyncEntryType.Directory) | |||
{ | |||
Pre.Assert(!string.IsNullOrEmpty(newFullPath), "newFullPath != null"); | |||
Directory.Move(fullPath, newFullPath); | |||
if (fullPath != newFullPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better written as string.equals.
if (fullPath != newFullPath) | |
if (!string.Equals(fullPath, newFullPath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be better.
Moving from a to b where a=b will caouse system.io.exception => job fails