32 lines
551 B
Bash
Executable File
32 lines
551 B
Bash
Executable File
#! /bin/bash
|
|
|
|
set -e
|
|
|
|
current_branch="$(git symbolic-ref --short HEAD)"
|
|
reference_branch="master"
|
|
|
|
common_ancestor="$(git merge-base ${current_branch} ${reference_branch})"
|
|
|
|
files_in_branch="$(git diff --name-only ${current_branch} ${common_ancestor})"
|
|
binary_files=""
|
|
|
|
for file in ${files_in_branch}
|
|
do
|
|
if ! file --mime $file | grep -q text
|
|
then
|
|
binary_files="${binary_files} ${file}"
|
|
fi
|
|
done
|
|
|
|
if [[ -n ${binary_files} ]]
|
|
then
|
|
echo "${binary_files}"
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|
|
|
|
function err() {
|
|
echo "check_add_bin: $*" 1>&2
|
|
}
|