summaryrefslogtreecommitdiff
path: root/check-correct-subproject.sh
diff options
context:
space:
mode:
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
+