ENGINE-883: script updates from hooks directory, Makefile fix for those who haven't put hooks in. Needs to be tested on other systems and won't save non-hooks-using windows users from themselves.

ENGINE-820
Krista Bennett 2 years ago
parent 10fd79d18e
commit f726fd607c

4
.gitignore vendored

@ -89,6 +89,10 @@ test/googletest
test/tmp/*
src/commit_hash.h
.idea/
venv/
venv2/
cleangit.py
# ignore generated test data

@ -1,25 +1,6 @@
#! /bin/sh
#
# Pseudo-smudge file for pEpEngine's commit-hash header
#
if [[ "$OSTYPE" == "darwin"* ]]; then
SED='sed -i '"'""'"
else
SED="sed -i"
fi
if test -f "src/commit_hash.h"; then
commit_hash="$(git rev-parse HEAD)"
echo "Replacing PEP_CURRENT_COMMIT_HASH value in src/commit_hash.h with current HEAD commit hash, $commit_hash. Will clean on commit or checkout."
$($SED "s/\(PEP_CURRENT_COMMIT_HASH=\).*/\1\"$commit_hash\"/" src/commit_hash.h)
# Whatever. You win, MacOS. You win.
if [[ "$OSTYPE" == "darwin"* ]]; then
rm src/commit_hash.h"'""'"
fi
fi
# Commit hash header file - if we don't run this, it won't build.
commit_hash="$(git rev-parse HEAD)"
sed "s/\(PEP_CURRENT_COMMIT_HASH\ =\).*/\1\"$commit_hash\"/" templates/commit_hash.h > src/commit_hash.h

@ -1,25 +1,6 @@
#! /bin/sh
#
# Pseudo-smudge file for pEpEngine's commit-hash header
#
if [[ "$OSTYPE" == "darwin"* ]]; then
SED='sed -i '"'""'"
else
SED="sed -i"
fi
if test -f "src/commit_hash.h"; then
commit_hash="$(git rev-parse HEAD)"
echo "Replacing PEP_CURRENT_COMMIT_HASH value in src/commit_hash.h with current HEAD commit hash, $commit_hash. Will clean on commit or checkout."
$($SED "s/\(PEP_CURRENT_COMMIT_HASH=\).*/\1\"$commit_hash\"/" src/commit_hash.h)
# Whatever. You win, MacOS. You win.
if [[ "$OSTYPE" == "darwin"* ]]; then
rm src/commit_hash.h"'""'"
fi
fi
# Commit hash header file - if we don't run this, it won't build.
commit_hash="$(git rev-parse HEAD)"
sed "s/\(PEP_CURRENT_COMMIT_HASH\ =\).*/\1\"$commit_hash\"/" templates/commit_hash.h > src/commit_hash.h

@ -0,0 +1,6 @@
#! /bin/sh
# Commit hash header file - if we don't run this, it won't build.
commit_hash="$(git rev-parse HEAD)"
sed "s/\(PEP_CURRENT_COMMIT_HASH\ =\).*/\1\"$commit_hash\"/" templates/commit_hash.h > src/commit_hash.h

@ -1,11 +1,3 @@
#! /bin/sh
grep "DUMMY_COMMIT_HASH_ERROR" src/commit_hash.h 1>/dev/null
if [ $? -eq 1 ]; then
staged_files=$(git diff-index --cached HEAD)
if [[ $staged_files == *commit_hash.h* ]]; then
echo "ERROR: You are checking in a modified src/commit_hash.h file which contains an unauthorised commit hash value - you shouldn't be. Please unstage it." >&2
echo "(Hint: git restore --staged src/commit_hash.h)"
exit 1
fi
fi
rm src/commit_hash.h

@ -48,6 +48,10 @@ else
$(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
endif
ifeq (,$(wildcard commit_hash.h))
$(shell cp ../templates/commit_hash.h ./commit_hash.h)
endif
ifdef SQLITE3_FROM_OS
NO_SOURCE+= sqlite3.c
CPPFLAGS+= -DSQLITE3_FROM_OS

@ -7,6 +7,19 @@
#ifndef PEP_INTERNAL_H
#define PEP_INTERNAL_H
#if defined __has_include
# if __has_include ("commit_hash.h")
# include "commit_hash.h"
# else
# define PEP_CURRENT_COMMIT_HASH="DUMMY_COMMIT_HASH_ERROR"
# endif
#else
// Well, we tried. Better hope the git setup is correct.
// IF NOT, or you aren't using git, please copy the commit_hash.h file from
// templates/ into src/ if this include fails.
# include "commit_hash.h"
#endif
#include "commit_hash.h" // We need this everywhere. So.
// maximum attachment size to import as key 25MB, maximum of 20 attachments

@ -1,7 +1,7 @@
#ifndef COMMIT_HASH_H
#define COMMIT_HASH_H
#define PEP_CURRENT_COMMIT_HASH="EMPTY_DUMMY_COMMIT_HASH_ERROR"
#define PEP_CURRENT_COMMIT_HASH = "DUMMY_COMMIT_HASH_ERROR"
#endif

Loading…
Cancel
Save