-
Notifications
You must be signed in to change notification settings - Fork 553
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
Fix "file clash" bug #541
Fix "file clash" bug #541
Conversation
Regarding the travis checks:
WDYT? |
@@ -112,11 +112,18 @@ def invoke_with_conflict_check(&block) | |||
if exists? | |||
on_conflict_behavior(&block) | |||
else | |||
say_status :create, :green |
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.
Why this was changed?
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.
If say_status
is before yield
, in case of a conflict we have a misleading message. For instance:
create doc/config/config.rb
file_clash doc/config/config.rb
lib/thor/actions/empty_directory.rb
Outdated
end | ||
|
||
destination | ||
rescue SystemCallError => e |
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.
It is better to rescue the specific exception here and avoid the unless
instead of the parent class.
Thanks for your review @rafaelfranca, sorry for the delay. I will address your comments in the next days. |
42c887c
to
36592e0
Compare
In some cases creating a file would raise an exception, due to clashes with existing file. E.g. creating a file where a directory with the same name is present. This fix rescue the exception and print a "file_clash" warning.
8758356
to
ab0cdfe
Compare
@rafaelfranca Thanks again for your review. I have addressed you comments and rebase my branch. |
Summary
In some cases creating a file would raise an exception, due to clashes with existing file. E.g. creating a file where a directory with the same name is present.
How to reproduce the bug
What happen using the bug fix
I would be more than happy to discuss further this issue. Feel free to comment about the naming and the approach.