From 133c4ba48b4642f3aaa2db0dda388104c6cbdb81 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Tue, 22 May 2012 11:58:40 -0500
Subject: [PATCH] bug fix: git 1.7.10 or later handling

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 build_deb.sh         | 9 ++++++---
 build_kernel.sh      | 9 ++++++---
 tools/rebuild.sh     | 9 ++++++---
 tools/rebuild_deb.sh | 9 ++++++---
 4 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/build_deb.sh b/build_deb.sh
index ee003039c..81786d581 100755
--- a/build_deb.sh
+++ b/build_deb.sh
@@ -47,8 +47,11 @@ then
 fi
 
 unset GIT_OPTS
-GIT_VERSION=$(git --version | awk '{print $3}')
-if [ "x${GIT_VERSION}" == "x1.7.10" ] ; then
+unset GIT_NOEDIT
+LC_ALL=C git help pull | grep -m 1 -e "--no-edit" &>/dev/null && GIT_NOEDIT=1
+
+if [ "${GIT_NOEDIT}" ] ; then
+	echo "Detected git 1.7.10 or later, this script will pull via [git pull --no-edit]"
 	GIT_OPTS+="--no-edit"
 fi
 
@@ -80,7 +83,7 @@ function git_kernel {
 
 		cd ${LINUX_GIT}/
 		echo "Updating LINUX_GIT tree via: git fetch"
-		git fetch
+		git fetch || true
 		cd -
 
 		if [ ! -f ${DIR}/KERNEL/.git/config ] ; then
diff --git a/build_kernel.sh b/build_kernel.sh
index 774bd0281..7b3d4232b 100755
--- a/build_kernel.sh
+++ b/build_kernel.sh
@@ -47,8 +47,11 @@ then
 fi
 
 unset GIT_OPTS
-GIT_VERSION=$(git --version | awk '{print $3}')
-if [ "x${GIT_VERSION}" == "x1.7.10" ] ; then
+unset GIT_NOEDIT
+LC_ALL=C git help pull | grep -m 1 -e "--no-edit" &>/dev/null && GIT_NOEDIT=1
+
+if [ "${GIT_NOEDIT}" ] ; then
+	echo "Detected git 1.7.10 or later, this script will pull via [git pull --no-edit]"
 	GIT_OPTS+="--no-edit"
 fi
 
@@ -80,7 +83,7 @@ function git_kernel {
 
 		cd ${LINUX_GIT}/
 		echo "Updating LINUX_GIT tree via: git fetch"
-		git fetch
+		git fetch || true
 		cd -
 
 		if [ ! -f ${DIR}/KERNEL/.git/config ] ; then
diff --git a/tools/rebuild.sh b/tools/rebuild.sh
index 026db99e6..dedab1f9b 100755
--- a/tools/rebuild.sh
+++ b/tools/rebuild.sh
@@ -47,8 +47,11 @@ then
 fi
 
 unset GIT_OPTS
-GIT_VERSION=$(git --version | awk '{print $3}')
-if [ "x${GIT_VERSION}" == "x1.7.10" ] ; then
+unset GIT_NOEDIT
+LC_ALL=C git help pull | grep -m 1 -e "--no-edit" &>/dev/null && GIT_NOEDIT=1
+
+if [ "${GIT_NOEDIT}" ] ; then
+	echo "Detected git 1.7.10 or later, this script will pull via [git pull --no-edit]"
 	GIT_OPTS+="--no-edit"
 fi
 
@@ -80,7 +83,7 @@ function git_kernel {
 
 		cd ${LINUX_GIT}/
 		echo "Updating LINUX_GIT tree via: git fetch"
-		git fetch
+		git fetch || true
 		cd -
 
 		if [ ! -f ${DIR}/KERNEL/.git/config ] ; then
diff --git a/tools/rebuild_deb.sh b/tools/rebuild_deb.sh
index 77941438b..bbe4b6fc0 100755
--- a/tools/rebuild_deb.sh
+++ b/tools/rebuild_deb.sh
@@ -47,8 +47,11 @@ then
 fi
 
 unset GIT_OPTS
-GIT_VERSION=$(git --version | awk '{print $3}')
-if [ "x${GIT_VERSION}" == "x1.7.10" ] ; then
+unset GIT_NOEDIT
+LC_ALL=C git help pull | grep -m 1 -e "--no-edit" &>/dev/null && GIT_NOEDIT=1
+
+if [ "${GIT_NOEDIT}" ] ; then
+	echo "Detected git 1.7.10 or later, this script will pull via [git pull --no-edit]"
 	GIT_OPTS+="--no-edit"
 fi
 
@@ -80,7 +83,7 @@ function git_kernel {
 
 		cd ${LINUX_GIT}/
 		echo "Updating LINUX_GIT tree via: git fetch"
-		git fetch
+		git fetch || true
 		cd -
 
 		if [ ! -f ${DIR}/KERNEL/.git/config ] ; then
-- 
GitLab