make.conf-repatch.sh: Port to git and improve coding style.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Sun, 21 Jul 2013 03:48:11 +0000 (05:48 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Sun, 21 Jul 2013 03:48:11 +0000 (05:48 +0200)
make.conf-repatch.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 6589e6b..790e667
@@ -6,35 +6,36 @@ die() {
        exit 1
 }
 
-if [ ! -f "make.conf" -o ! -f "make.conf.x86.diff" -o ! -d ".svn" ]; then
+if [[ ! -f make.conf || ! -f make.conf.x86.diff || ! -d ../.git ]]; then
        echo "ERROR: current directory is invalid" > /dev/stderr
        exit 1
 fi
 
-svn diff make.conf > make.conf.diff
-svn revert make.conf
+git diff --no-prefix --relative="$(basename "$(pwd)")" make.conf > make.conf.diff
+git checkout -- make.conf
 
+archs=()
 for x in make.conf.*.diff; do
-       archs="$archs $(basename ${x:10} .diff)"
+       archs+=("$(basename ${x:10} .diff)")
 done
 
 
-for arch in $archs; do
-       echo "* Patching $arch"
-       cp make.conf make.conf.$arch || die "copy failed"
-       patch -p0 make.conf.$arch < make.conf.${arch}.diff > /dev/null || die "arch-patch failed"
-       patch -p0 make.conf.$arch < make.conf.diff > /dev/null || die "patch failed"
+for arch in "${archs[@]}"; do
+       echo "* Patching ${arch}"
+       cp make.conf make.conf.${arch} || die "copy failed"
+       patch -p0 make.conf.${arch} < make.conf.${arch}.diff > /dev/null || die "arch-patch failed"
+       patch -p0 make.conf.${arch} < make.conf.diff > /dev/null || die "patch failed"
 done
 
 echo "* Re-patching make.conf"
 patch -p0 make.conf < make.conf.diff > /dev/null || die "repatch failed"
 
-for arch in $archs; do
-       echo "* Creating diff for $arch"
-       diff -u make.conf make.conf.$arch > make.conf.${arch}.diff
-       [ -z "${KEEP_ARCH_MAKE_CONF}" ] && rm -f make.conf.$arch make.conf.${arch}.orig
+for arch in "${archs[@]}"; do
+       echo "* Creating diff for ${arch}"
+       diff -u make.conf make.conf.${arch} > make.conf.${arch}.diff
+       [[ -z ${KEEP_ARCH_MAKE_CONF} ]] && rm -f make.conf.${arch} make.conf.${arch}.orig
 done
 
 rm make.conf.diff
 
-echo "Done"
\ No newline at end of file
+echo "Done"