This script should be used to refresh backport patches
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
--- /dev/null
+#!/bin/sh
+
+cwd=`dirname $0`
+out=patches_new
+
+if [ -d $out ]; then
+ if [ "$(ls -A $out)" ]; then
+ echo "output directory $out is not empty. Should delete all files in it?"
+ read -p "Are you sure? " -n 1
+ echo
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
+ echo "Removing $out"
+ rm -fr $out
+ else
+ echo "Aborting"
+ exit
+ fi
+ fi
+fi
+
+echo "Preparing patches"
+
+git format-patch -o $out --subject-prefix="PATCH" --no-numbered $1
+
+echo "Stripping id's from patches"
+for f in $out/*.patch; do
+ $cwd/strip.sh $f;
+done
+
+rm -f $out/*orig
--- /dev/null
+#!/bin/bash
+
+tmpfile='mktemp' || exit 1
+
+first=`head -1 $1`
+if [ ! "${first:0:5}" == "From " ]; then
+ echo Missing From at first line, abort
+ exit 1
+fi
+last=`tail -3 $1 | head -1`
+if [ ! "$last" == "-- " ]; then
+ echo Missing -- at 3rd last line, abort
+ exit 1
+fi
+
+head -n -3 $1 | \
+ sed -e "s/^index [[:xdigit:]]\{7\}\.\.[[:xdigit:]]\{7\} [[:digit:]]\{6\}$/index xxxxxxx..xxxxxxx xxxxxx/" | \
+ grep -v "^From " | \
+ grep -v "^Date: " > $tmpfile && mv $1 $1.orig && mv $tmpfile $1
+