- Notifications
You must be signed in to change notification settings - Fork530
Fix diffs of files that have quoted paths#450
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Closed
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Signed-off-by: James Couball <jcouball@yahoo.com>
3 tasks
A friendly reminder that this issue had no activity for 60 days. |
MemberAuthor
jcouball commentedDec 30, 2020
Since the origin branch was deleted, this PR was re-created in#504 |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
🚨Please review theguidelines for contributing to this repository.
Description
As was reported in#418, if
git diffreports a file path that has special characters like unicode, backslash, double quotes, etc. then the diff fails.lib/git/diff.rb
The problem was found to be in the diff parser not knowing how to deal with quoted paths.
lib/git/lib.rb
Additionally, we always tell git not to quote the paths in most cases so that Unicode characters come through without any special parsing. This is done by adding the
-c core.quotePath=falseto the global ops of all git commands. See the details of this option in thecore.quotePath documentation.tests/units/test_diff_with_quoted_path.rb
This test runs a diff containing two files: one whose path contains a backslash and double quote and one whose path with a non-ascii, unicode character in the filename. The diff should list first path with quotes and the second path without quotes like this:
Note the different between the lines beginning with
diff --git.tests/files/quoted_path/**/*
This is the test repository who last commit has two changes: one to
asdf\"asdfand one tomy_other_file_☠.tests/units/test_logger.rb
Since the
-c core.quotePathwas added to every command line, the logger tests had to be changed to ignore changes in global options.