Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

atremel
Copy link

@atremel atremel commented Feb 20, 2019

Moving from a to b where a=b will caouse system.io.exception => job fails

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);
Copy link
Owner

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)
Copy link
Owner

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.

Suggested change
if (fullPath != newFullPath)
if (!string.Equals(fullPath, newFullPath))

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants