Skip to main content

git_spelling

Function git_spelling 

Source
pub fn git_spelling(path: &Path) -> String
Expand description

Renders a path the way git spells one: forward slashes on every platform.

Git prints forward slashes on Windows too — git status, git ls-files, git diff --name-only, all of them — and so do the index, the pattern matcher and .gitattributes in this crate. A message that tells the user to git add a file has to spell it the way the git status next to it will, or the two do not look like the same file.

For a path inside the repository, and for an attribute source a reader is meant to paste back into git. An absolute filesystem path the user is to hand to their shell — a key file, a git directory, a destination for export-key — keeps its native separators and must not come through here.