Update create-from-patch.sh

This commit is contained in:
uazo 2022-01-14 14:39:12 +01:00 committed by GitHub
parent 53605d6156
commit 9fc297d1b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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