mirror of
https://github.com/Fakerr/git-recall.git
synced 2026-09-10 07:26:42 -04:00
fix small bug when printing diff
This commit is contained in:
parent
2ce9d43916
commit
e1620dd4ac
|
|
@ -26,7 +26,7 @@ COMMITS=""
|
|||
COMMITS_UNCOL=() # commits without colors
|
||||
LESSKEY=false
|
||||
SED_BIN="" # Sed option to use according OS.
|
||||
VERSION="1.1.8"
|
||||
VERSION="1.1.9"
|
||||
|
||||
# Are we in a git repo?
|
||||
if [[ ! -d ".git" ]] && ! git rev-parse --git-dir &>/dev/null; then
|
||||
|
|
@ -182,7 +182,8 @@ function get_diff() {
|
|||
DIFF_TIP=${ELT:0:7}
|
||||
DIFF_CMD="git show $DIFF_TIP --color=always"
|
||||
DIFF=$(eval ${DIFF_CMD} 2>/dev/null)
|
||||
off=$(echo "$DIFF" | grep -c ".\{$CN\}") #Number of lines in the diff that are longer than terminal width.
|
||||
tmp_diff="$(echo "$DIFF" | $SED_BIN "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")" # remove colors escape codes
|
||||
off=$(echo "$tmp_diff" | grep -c ".\{$CN\}") #Number of lines in the diff that are longer than terminal width.
|
||||
DIFF_LINES_NUMBER="$(echo "$DIFF" | wc -l)"
|
||||
DIFF_LINES_NUMBER=$(( DIFF_LINES_NUMBER + off ))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue