File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,18 @@ git status -su | tr \\r \\n | while read -r line ;
36
36
do
37
37
FILE=$( echo " $line " | awk ' {$1 = ""; print substr($0,2)}' )
38
38
STATUS=$( echo " $line " | awk ' {print substr($1,0,2)}' )
39
+ FILE_MIME=$( file --mime-type " $FILE " | grep -c text)
39
40
40
41
show_hr
41
42
42
43
tput smso
43
44
echo " Checking file: $FILE (status $STATUS )"
44
45
tput rmso
45
46
46
- if [ " $STATUS " = " M" ] || [ " $STATUS " = " AM" ] || [ " $STATUS " = " MM" ];
47
+ if [[ " $FILE_MIME " = 0 ]];
48
+ then
49
+ echo " I'm not able to show content of binary file!"
50
+ elif [ " $STATUS " = " M" ] || [ " $STATUS " = " AM" ] || [ " $STATUS " = " MM" ];
47
51
then
48
52
gdiff=$( git diff --color " $FILE " )
49
53
90
94
then
91
95
git reset " $FILE "
92
96
echo " File was unstaged"
97
+ elif [[ " $cmd " = " rm" ]];
98
+ then
99
+ rm " $FILE "
93
100
fi
94
101
95
102
done
You can’t perform that action at this time.
0 commit comments