Skip to content

Non-ASCII file paths not correctly extracted in changedFilesNames function #9114

@anda3

Description

@anda3

Describe the bug

The changedFilesNames function in diff.go does not correctly extract file paths that contain non-ASCII characters when the core.quotePath git parameter is set to true.

Version of GitHub CLI: gh version 2.49.2 (2024-05-13)

Steps to reproduce the behavior

  1. Set core.quotePath git parameter to true.
  2. Create a file with non-ASCII characters in its path.
  3. Run a git diff that includes the file.
  4. Pass the diff to the changedFilesNames function.

Expected vs actual behavior

Expected behavior: The function should correctly extract and output the file path, even if it contains non-ASCII characters and is quoted due to the core.quotePath git parameter being set to true.

Actual behavior: The function does not correctly extract the file path if it contains non-ASCII characters and is quoted.

Additional context

The issue seems to be with the regular expression used to extract the file paths from the diff. It does not account for quoted paths.

Possible solution

Update the regular expression to correctly handle quoted paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandhelp wantedContributions welcomep3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions