-
Notifications
You must be signed in to change notification settings - Fork 0
Distinguish a Confirmed Deletion From a Revision-Read Failure #1018
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: ptr727/ProjectTemplate
Length of output: 16306
🏁 Script executed:
Repository: ptr727/ProjectTemplate
Length of output: 50379
🏁 Script executed:
Repository: ptr727/ProjectTemplate
Length of output: 25447
🌐 Web query:
Git ls-tree core.quotePath non-ASCII path output documentation💡 Result:
By default, the git ls-tree command quotes "unusual" characters in pathnames to ensure safe display [1][2]. This quoting behavior is controlled by the configuration variable core.quotePath [3]. When core.quotePath is set to its default value (true), characters with values larger than 0x80—which includes many non-ASCII characters—are considered "unusual" and are escaped in the output using backslash-based octal sequences (e.g., \302\265) [3]. Additionally, control characters, double quotes, and backslashes are always escaped regardless of this setting [3]. To display non-ASCII pathnames verbatim, you have two primary options: 1. Use the -z option: Adding the -z flag to the git ls-tree command causes it to output pathnames as-is (verbatim) and uses a NUL byte as the line terminator instead of a newline [1][4]. This is generally the recommended approach for scripts or programmatic access [5][3]. 2. Configure core.quotePath: You can globally or locally disable this behavior by setting the configuration variable to false: git config core.quotePath false When set to false, bytes higher than 0x80 are no longer considered "unusual" and will not be escaped [3]. Note that double quotes, backslashes, and control characters will still remain escaped [3]. Documentation confirms that this mechanism ensures compatibility with various terminals and tools that might otherwise struggle with non-ASCII or control characters in filenames [1][3].
Citations:
Use explicit decoding for
git ls-treeoutput.When
core.quotePath=falseand the locale cannot decode a non-ASCII tracked path,text=Truecan raiseUnicodeDecodeErrorbefore_git_revisions()checkst.returncode. Setencoding="utf-8", errors="replace"or keep this subprocess output as bytes.🧰 Tools
🪛 ast-grep (0.45.2)
[error] 1745-1751: Command coming from incoming request
Context: subprocess.run(
["git", "ls-tree", sha, "--", rel_path],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(subprocess-from-request)
🤖 Prompt for AI Agents