Update create-from-patch.sh
This commit is contained in:
parent
53605d6156
commit
9fc297d1b0
@ -4,15 +4,15 @@ PATCH=$1
|
|||||||
|
|
||||||
PLEASEWAIT=0
|
PLEASEWAIT=0
|
||||||
if [[ $PATCH =~ ^+.* ]]; then
|
if [[ $PATCH =~ ^+.* ]]; then
|
||||||
PLEASEWAIT=1
|
PLEASEWAIT=1
|
||||||
PATCH=${PATCH:1}
|
PATCH=${PATCH:1}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$2" ]
|
if [ -z "$2" ]
|
||||||
then
|
then
|
||||||
PATCH_NEW_PATH="~/bromite/build/patches-new"
|
PATCH_NEW_PATH="~/bromite/build/patches-new"
|
||||||
else
|
else
|
||||||
PATCH_NEW_PATH=$2
|
PATCH_NEW_PATH=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " Creating new patch"
|
echo " Creating new patch"
|
||||||
@ -22,18 +22,18 @@ HEAD=$(sed -n '1,/---/ p' $PATCH | sed '/^---/d')
|
|||||||
CONTENT=$(git -C ~/chromium/src/ diff --cached --binary)
|
CONTENT=$(git -C ~/chromium/src/ diff --cached --binary)
|
||||||
|
|
||||||
PATCH_FILE=$PATCH_NEW_PATH/$(basename $PATCH)
|
PATCH_FILE=$PATCH_NEW_PATH/$(basename $PATCH)
|
||||||
rm $PATCH_FILE
|
test -f $PATCH_FILE && rm $PATCH_FILE
|
||||||
echo "$HEAD" >$PATCH_FILE
|
echo "$HEAD" >$PATCH_FILE
|
||||||
|
|
||||||
NEWLINE=$(tail -n 1 "$PATCH_FILE")
|
NEWLINE=$(tail -n 1 "$PATCH_FILE")
|
||||||
echo $NEWLINE
|
#echo $NEWLINE
|
||||||
if [[ "$NEWLINE" == Subject:* ]]; then
|
if [[ "$NEWLINE" == Subject:* ]]; then
|
||||||
echo "" >>$PATCH_FILE
|
echo "" >>$PATCH_FILE
|
||||||
else
|
else
|
||||||
NEWLINE=$(tail -n 2 "$PATCH_FILE" | head -n 1)
|
NEWLINE=$(tail -n 2 "$PATCH_FILE" | head -n 1)
|
||||||
if [[ "$NEWLINE" == Subject:* ]]; then
|
if [[ "$NEWLINE" == Subject:* ]]; then
|
||||||
echo "" >>$PATCH_FILE
|
echo "" >>$PATCH_FILE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "FILE:$(basename $PATCH)" >>$PATCH_FILE
|
echo "FILE:$(basename $PATCH)" >>$PATCH_FILE
|
||||||
@ -51,6 +51,9 @@ OK=1
|
|||||||
git am $PATCH_FILE || OK=0
|
git am $PATCH_FILE || OK=0
|
||||||
|
|
||||||
if [[ OK -eq 0 ]]; then
|
if [[ OK -eq 0 ]]; then
|
||||||
|
if [ -n "$SILENT" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "---> Failed to apply. Press return"
|
echo "---> Failed to apply. Press return"
|
||||||
read -n 1
|
read -n 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user