frostming / legit

Git for Humans, Inspired by GitHub for Mac™.
https://frostming.github.io/legit
BSD 3-Clause "New" or "Revised" License
5.7k stars 218 forks source link

PyPI archive: bash completion line end using '\r\n' #265

Closed JarryShaw closed 4 years ago

JarryShaw commented 4 years ago

As I recently found out, the bash completion script from the legit PyPI archive has its line end using CRLF:

$ xxd legit-1.2.0/extra/bash-completion/legit
00000000: 5f6c 6567 6974 2829 0d0a 7b0d 0a20 2020  _legit()..{..   
00000010: 206c 6f63 616c 2063 7572 2070 7265 7620   local cur prev 
00000020: 6f70 7473 0d0a 2020 2020 434f 4d50 5245  opts..    COMPRE

However, the release archive from GitHub, has its line end using LF:

$ xxd legit-1.2.0/extra/bash-completion/legit
00000000: 5f6c 6567 6974 2829 0a7b 0a20 2020 206c  _legit().{.    l
00000010: 6f63 616c 2063 7572 2070 7265 7620 6f70  ocal cur prev op
00000020: 7473 0a20 2020 2043 4f4d 5052 4550 4c59  ts.    COMPREPLY

Such line end using CRLF in the bash completion script will cause error message when opening a new Terminal on macOS:

-bash: /usr/local/etc/bash_completion.d/legit: line 1: syntax error near unexpected token `$'\r''
'bash: /usr/local/etc/bash_completion.d/legit: line 1: `_legit()

I suppose there're some issues with your distribution workflow...

NB: this issue was original raised from Homebrew/homebrew-core#51719

frostming commented 4 years ago

Oh, I will cut a new patch release to fix this issue