ENGINE-883: files for commit hash work. Still need to set up the how-to and ensure we go back and forth to older commits without choking.
parent
7abcfd2e8a
commit
a6fb33c8c0
@ -1 +1 @@
|
||||
*.h filter=commit_hash
|
||||
commit_hash.h filter=commit_hash
|
||||
|
@ -0,0 +1,25 @@
|
||||
#! /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
|
||||
|
@ -0,0 +1,11 @@
|
||||
#! /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
|
@ -1,19 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo "HELLO????" >&2
|
||||
|
||||
#
|
||||
# Smudge file for pEpEngine's commit-hash header
|
||||
#
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
SED="sed -i ''"
|
||||
else
|
||||
SED="sed -i"
|
||||
fi
|
||||
|
||||
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\"/" $1)
|
||||
|
Loading…
Reference in new issue