Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix diffs of files that have quoted paths#440

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
jcouball wants to merge1 commit intoruby-git:masterfromjcouball:fix_diff
Closed

Fix diffs of files that have quoted paths#440

jcouball wants to merge1 commit intoruby-git:masterfromjcouball:fix_diff

Conversation

@jcouball
Copy link
Member

Your checklist for this pull request

🚨Please review theguidelines for contributing to this repository.

  • Ensure all commits include DCO sign-off.
  • Ensure that your contributions pass unit testing.
  • Ensure that your contributions contain documentation if applicable.

Description

As was reported in#418, ifgit diff reports 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=false to 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:

$ git -c core.quotePath=false diff -p '@^'diff --git "a/asdf\"asdf" "b/asdf\"asdf"new file mode 100644index 0000000..e69de29diff --git a/my_other_file_☠ b/my_other_file_☠new file mode 100644index 0000000..e69de29$

Note the different between the lines beginning withdiff --git.

tests/files/quoted_path/**/*

This is the test repository who last commit has two changes: one toasdf\"asdf and one tomy_other_file_☠.

tests/units/test_logger.rb

Since the-c core.quotePath was added to every command line, the logger tests had to be changed to ignore changes in global options.

Signed-off-by: James Couball <jcouball@yahoo.com>
@jcouball
Copy link
MemberAuthor

jcouball commentedFeb 12, 2020
edited
Loading

Using PR#450 for the changes originally in this PR.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@jcouball

[8]ページ先頭

©2009-2025 Movatter.jp