summaryrefslogtreecommitdiff
path: root/scripts/check-git
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2023-04-24 12:50:20 +0200
committerWolfram Sang <wsa@kernel.org>2023-04-24 12:50:20 +0200
commit38c87827ffd3c7e1dd61eee9a7dea13d487dc2ed (patch)
treee6bd1c3ae56823874a736c1512409c123c9a4219 /scripts/check-git
parent9496fffcb28f39e0352779a0199b6e61861c9221 (diff)
parentd663d93bb47e7ab45602b227701022d8aa16040a (diff)
Merge branch 'i2c/for-current' into i2c/for-mergewindow
This should have been in 6.3, but sadly I missed it.
Diffstat (limited to 'scripts/check-git')
-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 000000000000..2ca6c5df10dd
--- /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