From 9fc297d1b0c4cf0a66c2d6bda5303abc1513e097 Mon Sep 17 00:00:00 2001 From: uazo <29201891+uazo@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:39:12 +0100 Subject: [PATCH] Update create-from-patch.sh --- create-from-patch.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/create-from-patch.sh b/create-from-patch.sh index 34182e8..b45a3dc 100644 --- a/create-from-patch.sh +++ b/create-from-patch.sh @@ -4,15 +4,15 @@ PATCH=$1 PLEASEWAIT=0 if [[ $PATCH =~ ^+.* ]]; then - PLEASEWAIT=1 - PATCH=${PATCH:1} + PLEASEWAIT=1 + PATCH=${PATCH:1} fi if [ -z "$2" ] then - PATCH_NEW_PATH="~/bromite/build/patches-new" + PATCH_NEW_PATH="~/bromite/build/patches-new" else - PATCH_NEW_PATH=$2 + PATCH_NEW_PATH=$2 fi echo " Creating new patch" @@ -22,18 +22,18 @@ HEAD=$(sed -n '1,/---/ p' $PATCH | sed '/^---/d') CONTENT=$(git -C ~/chromium/src/ diff --cached --binary) PATCH_FILE=$PATCH_NEW_PATH/$(basename $PATCH) -rm $PATCH_FILE +test -f $PATCH_FILE && rm $PATCH_FILE echo "$HEAD" >$PATCH_FILE NEWLINE=$(tail -n 1 "$PATCH_FILE") -echo $NEWLINE +#echo $NEWLINE if [[ "$NEWLINE" == Subject:* ]]; then - echo "" >>$PATCH_FILE + echo "" >>$PATCH_FILE else - NEWLINE=$(tail -n 2 "$PATCH_FILE" | head -n 1) - if [[ "$NEWLINE" == Subject:* ]]; then - echo "" >>$PATCH_FILE - fi + NEWLINE=$(tail -n 2 "$PATCH_FILE" | head -n 1) + if [[ "$NEWLINE" == Subject:* ]]; then + echo "" >>$PATCH_FILE + fi fi echo "FILE:$(basename $PATCH)" >>$PATCH_FILE @@ -51,6 +51,9 @@ OK=1 git am $PATCH_FILE || OK=0 if [[ OK -eq 0 ]]; then + if [ -n "$SILENT" ]; then + exit 1 + fi echo "---> Failed to apply. Press return" read -n 1 fi