From 6c0f31d622c9dbc5d4855faa76cab53e10961768 Mon Sep 17 00:00:00 2001 From: George Christou Date: Mon, 2 Apr 2018 21:51:07 +0100 Subject: [PATCH] completions: [git] Use builtin git truncation --- share/completions/git.fish | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 6721c879a..e4115f1c4 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -6,16 +6,14 @@ function __fish_git_commits # This allows filtering by subject with the new pager! # Because even subject lines can be quite long, # trim them (abbrev'd hash+tab+subject) to 73 characters - command git log --pretty=tformat:"%h"\t"%s" --all --max-count=1000 2>/dev/null \ - | string replace -r '(.{73}).+' '$1…' + command git log --pretty=tformat:"%h"\t"%<(64,trunc)%s" --all --max-count=1000 2>/dev/null end function __fish_git_recent_commits # Like __fish_git_commits, but not on all branches and limited to # the last 50 commits. Used for fixup, where only the current branch # and the latest commits make sense. - command git log --pretty=tformat:"%h"\t"%s" --max-count=50 2>/dev/null \ - | string replace -r '(.{73}).+' '$1…' + command git log --pretty=tformat:"%h"\t"%<(64,trunc)%s" --max-count=50 2>/dev/null end function __fish_git_branches