From 8d0aae1ce19e94ba5c7feab4d104bd3d72cc1e83 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Tue, 14 Jun 2016 14:57:03 +0300 Subject: [PATCH] Skip creating emty patches in debug mode --- common.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common.sh b/common.sh index 07ecae4b70..ac4006bc25 100644 --- a/common.sh +++ b/common.sh @@ -403,11 +403,15 @@ userpatch_create() # prompt to alter source display_alert "Make your changes in this directory:" "$(pwd)" "wrn" - display_alert "You will find a patch here:" "$SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y').patch" "wrn" read -p 'Press after you are done with changes to the source' git add . # create patch out of changes - git diff --staged > $SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y').patch + if [[ "$(git status --porcelain)" ]]; then + git diff --staged > $SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y').patch + display_alert "You will find your patch here:" "$SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y').patch" "info" + else + display_alert "No changes found, skipping patch creation" "" "wrn" + fi git reset --soft HEAD~ fi }