forked from pEp.foundation/pEpEngine
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.
parent
10fd79d18e
commit
f726fd607c
@ -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
|
||||
|
@ -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…
Reference in new issue