* More helpful error message for detected changes * Wrote the check backwards * more clear errors * Newline cinema
31 lines
1.1 KiB
Bash
Executable File
31 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# ------------- Import some defaults for the shell
|
|
|
|
# Source shell defaults
|
|
# $0 is the currently running program (this file)
|
|
this_file_directory=$(dirname $0)
|
|
relative_path_to_defaults=$this_file_directory/../shell_defaults
|
|
|
|
# if a file exists there, source it. otherwise complain
|
|
if test -f $relative_path_to_defaults; then
|
|
# source and '.' are the same program
|
|
source $relative_path_to_defaults
|
|
else
|
|
echo -e "\033[31m\nFAILED TO SOURCE TEST RUNNING OPTIONS.\033[39m"
|
|
echo -e "\033[31mTried $relative_path_to_defaults\033[39m"
|
|
exit 1
|
|
fi
|
|
|
|
diff_output="$(git --no-pager diff)"
|
|
|
|
set +o xtrace
|
|
if test -n "$diff_output"; then
|
|
echo -e "$red_text""File changes were detected! Lame!""$default_text"
|
|
echo -e "$red_text""This is usually do to forgetting to run a command locally before committing""$default_text"
|
|
echo -e "$red_text""try running the format command and see if you get a diff ""$default_text"
|
|
echo -e "$red_text""ie: SUB_BUILD=PLATFORM ./gradlew format --scan --info --stacktrace""$default_text"
|
|
else
|
|
echo -e "$blue_text""No git changes detected! Yay!""$default_text"
|
|
fi
|