-
Notifications
You must be signed in to change notification settings - Fork 71
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
Issue parsing files with space in filename #93
Comments
On Mon, Feb 21, 2022 at 01:20:35AM -0800, dperecab wrote:
Whenever there is a space in the route of the file, I keep getting the following error:
Probably we need to strip a trailing tab character, see commit
1a9eb3b9d5 (git-diff/git-apply: make diff output a bit friendlier to GNU patch (part 2), 2006-09-22)
in git/git
|
To confirm, was this related to a trailing tab character as mentioned? That would probably break the parsing regex, but I guess there shouldn't be a tab there? If you are still having issues, let me know, and if possible share some specific example and/or how you generate the diff. Thanks! |
It is the space character in the path of the file what is causing the issue. |
Changing the regex to the following seems to fix this type of error: RE_DIFF_GIT_HEADER = re.compile(
r'^diff --git (?P<source>a/.+) (?P<target>b/.+)') Can anyone shed some light on whether that is going to break anything? |
here's a minimal patch which triggers this issue: diff --git a/has spaces/t.sql b/has spaces/t.sql
new file mode 100644
index 0000000..8a9b485
--- /dev/null
+++ b/has spaces/t.sql
@@ -0,0 +1 @@
+select * FROM t; 0.7.2 seems to be the first version with this issue |
Whenever there is a space in the route of the file, I keep getting the following error:
File "/usr/local/lib/python3.9/site-packages/unidiff/patch.py", line 460, in __init__ self._parse(data, encoding=encoding, metadata_only=metadata_only) File "/usr/local/lib/python3.9/site-packages/unidiff/patch.py", line 530, in _parse raise UnidiffParseError('Target without source: %s' % line) unidiff.errors.UnidiffParseError: Target without source: +++ b/Audit Repositories/Interfaces/IMaintTransactionRepository.cs
This is an example:
diff --git a/Audit Repositories/Interfaces/IMaintTransactionRepository.cs b/Audit Repositories/Interfaces/IMaintTransactionRepository.cs new file mode 100644 index 0000000..f95add3
or another one:
diff --git a/repairer_allocation_etl/src/test/resources/NCR API GW.postman_collection.json b/repairer_allocation_etl/src/test/resources/NCR API GW.postman_collection.json new file mode 100644 index 0000000..fdd8387
While debugging, I've seen that current_file.target_file is set to "Repositories/Interfaces/IMaintTransactionRepository.cs", while target_file is being correctly set to "b/Audit Repositories/Interfaces/IMaintTransactionRepository.cs"
The text was updated successfully, but these errors were encountered: