summaryrefslogtreecommitdiff
path: root/check-correct-subproject.sh
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-21 21:17:41 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-21 21:17:41 +0200
commitf25b818d9d41e2bb3969399cfc8bbff976b5aad7 (patch)
tree5f9137b374dfca42f596851c85116c9da181fa50 /check-correct-subproject.sh
downloadultra-notifier-f25b818d9d41e2bb3969399cfc8bbff976b5aad7.tar.gz
ultra-notifier-f25b818d9d41e2bb3969399cfc8bbff976b5aad7.tar.bz2
ultra-notifier-f25b818d9d41e2bb3969399cfc8bbff976b5aad7.zip
Init
Diffstat (limited to 'check-correct-subproject.sh')
-rwxr-xr-xcheck-correct-subproject.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/check-correct-subproject.sh b/check-correct-subproject.sh
new file mode 100755
index 0000000..023e5d4
--- /dev/null
+++ b/check-correct-subproject.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# git hook to make sure you check out the current core version before committing
+# to install, place it into your git hook folder with the appropriate name:
+#
+# cp check-correct-subproject.sh .git/hooks/pre-commit
+#
+# OR (to check a bit earlier)
+#
+# cp check-correct-subproject.sh .git/hooks/prepare-commit-msg
+#
+
+currentMainProject="$(git show :versions/mainProject|tr -d '\n')"
+currentMainVersion="$(git show :mainProject|tr -d '\n')"
+if [ "x$currentMainVersion" != "x$currentMainProject" ]; then
+ echo "Currently checked out version is $currentMainProject, but $currentMainVersion should be committed."
+ echo "Run ./gradlew :${currentMainVersion}:setCoreVersion to fix"
+ echo
+ exit 1
+else
+ echo "Correct core version $currentMainVersion checked out"
+fi
+