Handle gpg signing better (#1123)

Instead of checking whether it was set previously, setting it to false,
then setting it back to true if it was true before, just use the
command-line argument in git to override the config for that command.
Using a variable makes it pretty painless to do.
This commit is contained in:
Kyle Wood 2018-05-24 13:41:50 -05:00 committed by Zach
parent 3eb1cdef72
commit d45565f83b
10 changed files with 87 additions and 102 deletions

View file

@ -4,15 +4,16 @@
PS1="$"
basedir="$(cd "$1" && pwd -P)"
workdir="$basedir/work"
gitcmd="git -c commit.gpgsign=false -c core.safecrlf=false"
echo "Rebuilding patch files from current fork state..."
git config core.safecrlf false
function cleanupPatches {
cd "$1"
for patch in *.patch; do
echo "$patch"
gitver=$(tail -n 2 "$patch" | grep -ve "^$" | tail -n 1)
diffs=$(git diff --staged "$patch" | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)")
diffs=$($gitcmd diff --staged "$patch" | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)")
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
if [ "x$testver" != "x" ]; then
@ -20,8 +21,8 @@ function cleanupPatches {
fi
if [ "x$diffs" == "x" ] ; then
git reset HEAD "$patch" >/dev/null
git checkout -- "$patch" >/dev/null
$gitcmd reset HEAD "$patch" >/dev/null
$gitcmd checkout -- "$patch" >/dev/null
fi
done
}
@ -50,9 +51,9 @@ function savePatches {
cd "$basedir/$target"
git format-patch --no-stat -N -o "$basedir/${what_name}-Patches/" upstream/upstream >/dev/null
$gitcmd format-patch --no-stat -N -o "$basedir/${what_name}-Patches/" upstream/upstream >/dev/null
cd "$basedir"
git add -A "$basedir/${what_name}-Patches"
$gitcmd add -A "$basedir/${what_name}-Patches"
cleanupPatches "$basedir/${what_name}-Patches"
echo " Patches saved for $what to $what_name-Patches/"
}