aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src/bash/git-pre-commit
diff options
context:
space:
mode:
authorRaul Infante-Sainz <infantesainz@gmail.com>2019-02-28 12:32:19 +0000
committerRaul Infante-Sainz <infantesainz@gmail.com>2019-02-28 12:32:19 +0000
commit62cb377a954921ef7940059e6dfb8521f9698c32 (patch)
tree9c3946535d7940b6e6ae6d2b3bde60c5edd11bd7 /reproduce/src/bash/git-pre-commit
parenta92b25adb31bde17fe4db4f37be11bbe389fdf4b (diff)
Git hooks for metastore check for the existance of metastore
Until now, once the Git hooks have been installed (after the installation of Metastore), if metastore doesn't exist (for example by manually deleting the build directory for a re-build with same configurations as before) we can't run `git commit' and `git checkout' will print an ugly warning. With this commit, the two Git hooks check for the existance of Metastore and if it doesn't exist, they won't do anything.
Diffstat (limited to 'reproduce/src/bash/git-pre-commit')
-rw-r--r--reproduce/src/bash/git-pre-commit11
1 files changed, 8 insertions, 3 deletions
diff --git a/reproduce/src/bash/git-pre-commit b/reproduce/src/bash/git-pre-commit
index ca28757..0fa6c52 100644
--- a/reproduce/src/bash/git-pre-commit
+++ b/reproduce/src/bash/git-pre-commit
@@ -20,8 +20,13 @@
# git reset HEAD -- .metadata
# git checkout HEAD -- .metadata
-# File containig the metadata.
+# File containig the metadata and metastore executable.
MSFILE=".file-metadata"
+MSBIN=@BINDIR@/metastore
+
+# If metastore is not installed, then ignore this script (exit with a
+# status of 0).
+if [ ! -f $MSBIN ]; then exit 0; fi
# Function to help in reporting a crash.
exit_on_fail() {
@@ -34,12 +39,12 @@ exit_on_fail() {
# Run metastore.
exit_on_fail \
- @BINDIR@/metastore -O @USER@ -G @GROUP@ -s -f "$MSFILE"
+ $MSBIN -O @USER@ -G @GROUP@ -s -f "$MSFILE"
# If it's first metastore commit, store again to include $MSFILE in $MSFILE.
if ! git-ls-tree --name-only HEAD 2>/dev/null | grep -Fqx "$MSFILE"; then
exit_on_fail \
- @BINDIR@/metastore -O @USER@ -G @GROUP@ -s -f "$MSFILE"
+ $MSBIN -O @USER@ -G @GROUP@ -s -f "$MSFILE"
fi
# Check if the metadata file exists.