From daf357aaab2267d03b2c98cb8329dea508765edd Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 25 Mar 2020 18:21:08 -0700 Subject: [PATCH] tools: Give `require_clean_work_tree` our nice UI touches. Notably, print the details of what's modified. --- tools/lib/git-tools.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/lib/git-tools.bash b/tools/lib/git-tools.bash index 8351ead33a..a02469bff5 100644 --- a/tools/lib/git-tools.bash +++ b/tools/lib/git-tools.bash @@ -6,7 +6,7 @@ # this function has only needed one edit since then, adding localization # with gettext, which we can omit. require_clean_work_tree () { - local action="$1" message="${2-}" + local action="$1" git rev-parse --verify HEAD >/dev/null || exit 1 git update-index -q --ignore-submodules --refresh @@ -27,7 +27,8 @@ require_clean_work_tree () { fi if [ $err = 1 ]; then - [ -n "$message" ] && echo >&2 "$message" + git status --short + echo >&2 "Doing nothing to avoid losing your work." exit 1 fi }