File tree 3 files changed +15
-6
lines changed
3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # shellcheck disable=SC2034 # CUSTOM_GIT_PAGER appears unused. Verify use (or export if used externally)
4
+
5
+ CUSTOM_GIT_PAGER=" $( git config core.pager || echo ' cat' ) "
Original file line number Diff line number Diff line change 3
3
# shellcheck disable=SC2155
4
4
# shellcheck disable=SC1091
5
5
6
+ source " ${__CUSTOM_GIT_UTIL} " /__common
6
7
source " $__CUSTOM_CONSOLE_UTIL " /__split_str
7
8
source " $__CUSTOM_CONSOLE_UTIL " /__trim_double_quotes
8
9
@@ -15,10 +16,10 @@ function __gdiff_preview() {
15
16
file=" $( __trim_double_quotes " ${file} " ) "
16
17
17
18
if [[ ${str: 0: 1} != " " ]]; then # file is staged
18
- git diff --cached --color -- " ${file} "
19
+ git diff --cached --color -- " ${file} " | ${CUSTOM_GIT_PAGER}
19
20
fi
20
21
if [[ ${str: 1: 1} != " " ]]; then # file is unstaged
21
- git diff --color -- " ${file} "
22
+ git diff --color -- " ${file} " | ${CUSTOM_GIT_PAGER}
22
23
fi
23
24
return
24
25
fi
@@ -37,12 +38,12 @@ function __gdiff_preview() {
37
38
done
38
39
39
40
if [[ ${str: 0: 1} == " R" ]]; then
40
- git diff --cached --color -- " ${oldFile} " " ${newFile} "
41
+ git diff --cached --color -- " ${oldFile} " " ${newFile} " | ${CUSTOM_GIT_PAGER}
41
42
42
43
if [[ ${str: 1: 1} != " " ]]; then
43
- git diff --color -- " ${newFile} "
44
+ git diff --color -- " ${newFile} " | ${CUSTOM_GIT_PAGER}
44
45
fi
45
46
else
46
- git diff --color -- " ${oldFile} " " ${newFile} "
47
+ git diff --color -- " ${oldFile} " " ${newFile} " | ${CUSTOM_GIT_PAGER}
47
48
fi
48
49
}
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
# shellcheck disable=SC2155
4
+ # shellcheck disable=SC1091 # Not following: ./__common was not specified as input (see shellcheck -x)
5
+
6
+ source " ${__CUSTOM_GIT_UTIL} " /__common
4
7
5
8
function __gshow_preview() {
6
9
@@ -9,5 +12,5 @@ function __gshow_preview() {
9
12
if [[ -z " ${commitSHA} " ]]; then
10
13
return
11
14
fi
12
- git show --color=always " ${commitSHA} "
15
+ git show --color=always " ${commitSHA} " | ${CUSTOM_GIT_PAGER}
13
16
}
You can’t perform that action at this time.
0 commit comments