mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-29 06:00:28 +08:00
Fixes requesting a directory containing another directory with [brackets] in its name disable_pathspec_match(true) sets the GIT_DIFF_DISABLE_PATHSPEC_MATCH flag on libgit2's diff options. Normally, pathspecs are matched using fnmatch/glob pattern matching, where [ starts a character class, * and ? are wildcards, and \ is the escape character. With this flag, pathspecs are treated as literal strings with prefix matching for directories. So src/[something] matches exactly src/[something] and any files under it, rather than [something] being interpreted as a glob character class matching a single character from the set s, o, m, e, etc. Removing escaped_name is OK because the old escaped_name doubled backslashes(\ -> \\) specifically because pathspecs used glob/fnmatch interpretation, where \ is the escape character. The doubling made pathspec where \ is the escape character. The doubling made pathspec treat \\ as "match a literal \". With disable_pathspec_match(true), there's no glob interpretation at all, so \ is already treated literally. The doubling is no longer needed and would actually break things (pathspec would look for \\ instead of \). Regarding Windows, escaped_name has no impact on Windows behavior. On Windows, \ is the path separator and cannot appear in filenames, so escaped_name was effectively a no-op on Windows anyway. The existing test for backslash filenames (special/faux\path) is already gated with `#[cfg(not(windows))]` since such filenames only exist on Unix. So removing escaped_name has no impact on Windows behavior.