Closed sandr01d closed 10 months ago
Hi @sandr01d can you give a minimal example to reproduce the error you're fixing here?
Hi @sandr01d can you give a minimal example to reproduce the error you're fixing here?
Reading back my description I really could have done a better job explaining this. So there are two issues that I fixed with this PR. The first one is that variables were not properly escaped, which led to issues trying to open them in the editor using the ctrl+e shortcut. You can reproduce it like this:
ga
Your editor will open, but it will open the wrong file (the file name will be everything before the first space).
The second issue affects files that were renamed:
# create any file
touch file
# commit the file
git add file
git commit -m "some message"
# rename the file
mv file new-name
# add the changes
git add .
# inspect the staged changed
gd --staged
The renamed file will show up correctly, but if you try to edit it by pressing ctrl+e, you editor will open a file that consists of both file names (testnew-name
in this example).
@sandr01d Great, thanks a lot! Can confirm that the fix works for me.
Check list
Description
Escaped variables in _forgit_add() and _forgit_diff() to fix opening files that contain spaces. Added a separate sed command for retrieving a file in _forgit_diff() that correctly handles renamed files (when opening the editor while diffing staged changes).
Type of change
Test environment