This is a straight backport of https://gcc.gnu.org/ml/gcc-patches/2018-04/msg01352.html. Without this contrib/gcc_update fails if run from a worktree, while git pull works just fine.

Pushed to the gcc-8 branch.

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 039dc251ebb..47ac7c47dcc 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-15  Richard Earnshaw  <rearn...@arm.com>
+
+	Backport:
+	2018-05-01  Jim Wilson  <j...@sifive.com>
+
+	* gcc_update: Check for .git as a file.
+
 2019-08-16  Uros Bizjak  <ubiz...@gmail.com>
 
 	* test_summary: Do not escape "=".
diff --git a/contrib/gcc_update b/contrib/gcc_update
index a33bb543902..c9c71548f53 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -286,7 +286,7 @@ p
 esac
 
 # Check for known version control systems.
-if [ -d .git ]; then
+if [ -d .git ] || [ -f .git ]; then
     GCC_GIT=${GCC_GIT-${GIT-git}}
     vcs_type="git"
 elif [ -d .hg ]; then

Reply via email to