junegunn / fzf-git.sh

bash and zsh key bindings for Git objects, powered by fzf
612 stars 53 forks source link

_fzf_git_hashes depends on awk implementation #17

Closed jpalus closed 2 years ago

jpalus commented 2 years ago

It appears that interval expressions ({<n>,<m>} as in /[a-f0-9]{7,}/) in AWK's regular expressions are somewhat fuzzy subject. Newer versions of gawk support it by default, older versions of gawk require additional option, mawk does not support them. Also see: https://www.gnu.org/software/gawk/manual/html_node/Interval-Expressions.html

In my system awk points to mawk hence hashes do not work. Would it be possible to either:

  1. Replace this single regex with /[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*/ so it's compatible with all awk implementations (preferably)
  2. Or use gawk command instead of awk and require gawk >= 4.0
junegunn commented 2 years ago
  1. Replace this single regex with /[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*/ so it's compatible with all awk implementations (preferably)

I'm okay with this approach. Can you open a pull request?