first Patch!

This commit is contained in:
mohammed jasem alaajel 2021-06-14 21:18:52 +04:00
parent ffaf45dbf6
commit 9c26dd1692
3 changed files with 18506 additions and 0 deletions

File diff suppressed because it is too large Load Diff

43
applyPatches.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh
PS1="$"
basedir=`pwd`
applyPatch() {
pfoldername=$1
what=$2
target=$3
branch=$4
cd "$basedir"
if [ ! -d "$target" ]; then
git clone $what $target
fi
echo "$basedir/$target"
cd "$basedir/$target"
echo "Resetting $target to $what..."
git config commit.gpgSign false
git remote rm origin >/dev/null 2>&1
git remote add origin $what >/dev/null 2>&1
git checkout master >/dev/null 2>&1
git fetch origin >/dev/null 2>&1
git reset --hard $branch
echo " Applying patches to $target..."
git am --abort >/dev/null 2>&1
git am --3way "../${pfoldername}-Patches/"*.patch
if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
echo " Please review above details and finish the apply then"
echo " save the changes with rebuildPatches.sh"
exit 1
else
echo " Patches applied cleanly to $target"
fi
}
git submodule update --init
cd FastLogin
hash=$(git rev-parse HEAD)
git branch -f main "$hash"
applyPatch LimeLogin FastLogin LimeLogin-Plugin main

44
reBuildPatches.sh Normal file
View File

@ -0,0 +1,44 @@
#!/bin/bash
PS1="$"
basedir=`pwd`
clean=$1
echo "Rebuilding patch files from current project.........."
cleanupPatches() {
cd "$1"
for patch in *.patch; do
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)")
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
if [ "x$testver" != "x" ]; then
diffs=$(echo "$diffs" | head -n -2)
fi
if [ "x$diffs" == "x" ] ; then
git reset HEAD $patch >/dev/null
git checkout -- $patch >/dev/null
fi
done
}
savePatches() {
what=$1
target=$2
branch=$3
cd "$basedir/$target"
git format-patch -1 --no-stat -N -o "../${what}-Patches/" $branch
cd "$basedir"
git add -A "${what}-Patches"
if [ "$clean" != "clean" ]; then
cleanupPatches "${what}-Patches"
fi
echo " Patches saved for $what to $what-Patches/"
}
if [ "$clean" == "clean" ]; then
rm -rf *-Patches
fi
savePatches LimeLogin LimeLogin-Plugin main