summaryrefslogtreecommitdiffstats
path: root/scripts/check-git
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/check-git14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/check-git b/scripts/check-git
new file mode 100755
index 0000000000..2ca6c5df10
--- /dev/null
+++ b/scripts/check-git
@@ -0,0 +1,14 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# succeed if we are in a git repository
+
+srctree="$(dirname $0)/.."
+
+if ! git -C "${srctree}" rev-parse --verify HEAD >/dev/null 2>/dev/null; then
+ exit 1
+fi
+
+if ! test -z $(git -C "${srctree}" rev-parse --show-cdup 2>/dev/null); then
+ exit 1
+fi