Closed sandr01d closed 1 month ago
I found out that my changes introduced a bug where ga
would no longer display the status indicator for the files (e.g., [M] for a modified file). This also lead to an issue where a file could not be added if it matched the regex in the sed
command and therefore brackets got added around part of the path. I mainly reverted changes in _forgit_add
back to the state of the master branch, but feel free to rereview this if you like. I'll give this a few days of extra testing to see if anything else comes up, so please don't merge yet.
Check list
Description
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. Sincegit clean
does not support the -z flag, we disablecore.quotePath
by passing a configuration parameter in_forgit_clean
. This fixes #325Note
This PR is based on #386. I will request reviews once #386 has been merged.
Type of change
Test environment