scmbreeze / scm_breeze

Adds numbered shortcuts to the output git status, and much more
https://madebynathan.com/2011/10/19/git-shortcuts-like-youve-never-seen-before/
MIT License
2.82k stars 192 forks source link

Git status shortcuts broken edge case: filename with spaces #268

Open LeZuse opened 5 years ago

LeZuse commented 5 years ago

To reproduce simply create a file with spaces in its name. Git will show this:

$ git status
# On branch: master  |  [*] => $e
#
➤ Untracked files
#
#      untracked: [1] "my todo.txt"
#

$e1 now contains invalid filename:

$ echo $e1
/Users/zuse/Projects/pb-frontend/"my todo.txt"
$ cat $e1
cat: /Users/zuse/Projects/pb-frontend/"my: No such file or directory
cat: todo.txt": No such file or directory
$ cat "$e1"
cat: /Users/zuse/Projects/pb-frontend/"my todo.txt": No such file or directory
$ git --version
git version 2.10.2
$ cd ~/.scm_breeze/
$ git show --oneline
8a326c2 Merge pull request #262 from ghthor/refactor_of_git_status

Related to #267

ghthor commented 5 years ago

I fixing this by reverting for now. We need better test coverage to handle a major change like the refactorization that was merged in #262

HaleTom commented 5 years ago

@ghthor I believe the offending commit is: 750697e.

In shell variables, the filenames should be literal (without quoting).

The filenames are preserved intact by quoting only at usage time:

cat "$e1"

Would you be willing to make a branch without this commit?

HaleTom commented 5 years ago

Oh, I see it's larger than that... Eg #267.

ghthor commented 5 years ago

Yep, It's still my lack of ruby knowledge that is holding me back from hacking this back out over a weekend.