fish: functions/gl: Fix object ID ambiguous error

7 digit hash is sometimes not enough to correctly show
the commit.
This commit is contained in:
Sanchayan Maity 2024-07-16 19:52:20 +05:30
parent cf4d2ea2b4
commit 135d59f37c
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -4,7 +4,7 @@ function gl --description 'Git browse commits'
return 0 return 0
end end
set -l log_line_to_hash "echo {} | grep -o '[a-f0-9]\{7\}' | head -1" set -l log_line_to_hash "echo {} | grep -o '[a-f0-9]\{9\}' | head -1"
set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | bat -ldiff'" set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | bat -ldiff'"
set -l view_commit_nvim "$log_line_to_hash | xargs -I % sh -c 'git show %'" set -l view_commit_nvim "$log_line_to_hash | xargs -I % sh -c 'git show %'"
set -l copy_commit_hash "$log_line_to_hash | wl-copy" set -l copy_commit_hash "$log_line_to_hash | wl-copy"