-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: file commands do not work with paths containing special characters
Git escapes special characters in it's output when core.quotePath is true or unset. Git always expects unquoted file paths as input. This leads to issues when we consume output from git and use it to build input for other git commands. This commit ensures we always feed unqoted paths to git commands. The _forgit_list_files function is introduced to handle usage of git ls-files with the -z flag, which ensures unquoted paths. It replaces the direct calls to git ls-files in _forgit_reset_head, _forgit_stash_push and _forgit_checkout_file. In _forgit_add the current approach of using colors to separate unstaged from staged files is replaced with a call to _forgit_ls_files with the appropriate flags to only list unstaged files. In _git_reset_head the -z option is added to the git diff command to ensure unqoted paths. Since git clean does not support the -z flag, we disable core.quotePath by passing a configuration parameter in _forgit_clean.
- Loading branch information
Showing
1 changed file
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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