Skip to content
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(import): Support non-ASCII characters in file paths #2441

Merged
merged 1 commit into from May 23, 2020

Conversation

WeiAnAn
Copy link
Contributor

@WeiAnAn WeiAnAn commented Feb 8, 2020

Description

When importing, if any file path contain non-ascii char like Chinese, it will occur an error.

ValidationError: Failed to apply commit f60aec4.
    Command failed: git am -3 --keep-non-patch
    error: mode change for packages/91b633aa89e0fab2957cc60ec58fe8c5/"\346\252\224\346\241\210", which is not in current HEAD
    error: could not build fake ancestor
    Applying: rename
    Patch failed at 0001 rename
    Use 'git am --show-current-patch' to see the failed patch
    When you have resolved this problem, run "git am --continue".
    If you prefer to skip this patch, run "git am --skip" instead.
    To restore the original branch and stop patching, run "git am --abort".

Because git will wrap non-ascii file path by ", the path replacement does not handle this.

Motivation and Context

Fix by checking " in regular expression in replacement.

How Has This Been Tested?

Add a unit test.
The test include git file add, rename and copy action.
I think it cover all regexp.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tomyam1
Copy link

tomyam1 commented Feb 17, 2020

Tried this patch after I couldn't import repo (same error as above) with some Hebrew file names and it worked great. Thanks

@evocateur evocateur changed the title fix (import): support import file path contain non-ascii char fix(import): Support non-ASCII characters in file paths May 23, 2020
Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience!

@evocateur evocateur merged commit c74ffa4 into lerna:master May 23, 2020
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.

None yet

3 participants