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

Header matching fails on unicode filenames (git diff) #5

Open
thoward opened this issue Jun 16, 2016 · 1 comment
Open

Header matching fails on unicode filenames (git diff) #5

thoward opened this issue Jun 16, 2016 · 1 comment

Comments

@thoward
Copy link
Contributor

thoward commented Jun 16, 2016

I came across a git header that contained filenames with unicode. Git chose to wrap those in quotes. The regex git_diffcmd_header in patch.py couldn't parse the filenames out of the header due to the quotes.

I monkey patched this in my code with the following line:

whatthepatch.patch.git_diffcmd_header = re.compile('^diff --git "?a/(.+)"? "?b/(.+)"?$')

That seems to work!

Here's an example of the offending diff header (could be used as a fixture):

diff --git "a/somedata\340\270\202\340\270\233.json" "b/somedata\340\270\202\340\270\233.json"
deleted file mode 100644
index 817de57..0000000
--- "a/somedata\340\270\202\340\270\233.json"
+++ /dev/null
@@ -1 +0,0 @@
-[...snip...]
@graingert
Copy link
Contributor

@thoward can you make a PR with these changes?

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

No branches or pull requests

2 participants