wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.33k stars 136 forks source link

Fish: ga does not work when there are spaces in file name #172

Closed cjappl closed 2 years ago

cjappl commented 2 years ago

Check list

Environment info

Problem / Steps to reproduce

Steps to repro:

touch "some file with spaces in it" ga

Looks like:

Screen Shot 2021-12-05 at 3 04 54 PM

This is a regression, something in fish changed. Originally our forgit::add function looked like this:

        set extract_file "
        sed 's/^[[:space:]]*//' |           # remove leading whitespace
        cut -d ' ' -f 2- |                  # cut the line after the M or ??, this leaves just the filename
        sed 's/.* -> //' |                  # for rename case
        sed -e 's/^\\\"//' -e 's/\\\"\$//'  # removes surrounding quotes
    "

but that resulted in #170, so I removed the line making it:

    set extract_file "
        sed 's/^[[:space:]]*//' |           # remove leading whitespace
        cut -d ' ' -f 2- |                  # cut the line after the M or ??, this leaves just the filename
        sed 's/.* -> //'                   # for rename case
    "

This fixed it, but we aren't removing the surrounding quotes properly anymore. Going to reach out in the fish project to see if anyone knows what is up. This was not a problem in earlier versions of fish

cjappl commented 2 years ago

Closing for now, as it was fixed in that reversion