tdlight/gen_git_commit_h.sh
Arseny Smirnov 71d03f39c3 Project import generated by Copybara.
GitOrigin-RevId: 318483224ad6164d9966f731d60cde37039bb2d4
2017-12-31 23:08:40 +03:00

12 lines
328 B
Bash
Executable File

#!/bin/sh
commit=$(git rev-parse HEAD)
git diff-index --quiet HEAD
dirty=$?
printf "#pragma once\n#define GIT_COMMIT \"$commit\"\n#define GIT_DIRTY $dirty\n" > auto/git_info.h.new
if cmp -s auto/git_info.h.new auto/git_info.h 2>&1 > /dev/null
then
rm -f auto/git_info.h.new
else
mv -f auto/git_info.h.new auto/git_info.h
fi