mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Be more verbose with debug script output
If output of `git status -s` is non-null display changes if output of `git diff` is non-null, display diff Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
parent
9748f19172
commit
a145f1d931
@ -269,6 +269,9 @@ compare_local_version_to_git_version() {
|
|||||||
# The commit they are on
|
# The commit they are on
|
||||||
local remote_commit
|
local remote_commit
|
||||||
remote_commit=$(git describe --long --dirty --tags --always)
|
remote_commit=$(git describe --long --dirty --tags --always)
|
||||||
|
# Status of the repo
|
||||||
|
local local_status
|
||||||
|
local_status=$(git status -s)
|
||||||
# echo this information out to the user in a nice format
|
# echo this information out to the user in a nice format
|
||||||
# If the current version matches what pihole -v produces, the user is up-to-date
|
# If the current version matches what pihole -v produces, the user is up-to-date
|
||||||
if [[ "${remote_version}" == "$(pihole -v | awk '/${search_term}/ {print $6}' | cut -d ')' -f1)" ]]; then
|
if [[ "${remote_version}" == "$(pihole -v | awk '/${search_term}/ {print $6}' | cut -d ')' -f1)" ]]; then
|
||||||
@ -291,6 +294,16 @@ compare_local_version_to_git_version() {
|
|||||||
fi
|
fi
|
||||||
# echo the current commit
|
# echo the current commit
|
||||||
log_write "${INFO} Commit: ${remote_commit}"
|
log_write "${INFO} Commit: ${remote_commit}"
|
||||||
|
# if `local_status` is non-null, then the repo is not clean, display details here
|
||||||
|
if [[ ${local_status} ]]; then
|
||||||
|
#Replace new lines in the status with 12 spaces to make the output cleaner
|
||||||
|
log_write "${INFO} Status: ${local_status//$'\n'/'\n '}"
|
||||||
|
local local_diff
|
||||||
|
local_diff=$(git diff)
|
||||||
|
if [[ ${local_diff} ]]; then
|
||||||
|
log_write "${INFO} Diff: ${local_diff//$'\n'/'\n '}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# If git status failed,
|
# If git status failed,
|
||||||
else
|
else
|
||||||
# Return an error message
|
# Return an error message
|
||||||
|
Loading…
Reference in New Issue
Block a user