Damon Caskey
As you requested I have made a git hook that will record what should be the build number by recording the master branch commit count then adding the current branch's commits ahead of master so when merged you should get the correct build number matching the commit count on master after the merge.
There is a small window of error if two pull requests are made at the same time but as all pull requests have to be reviewed this can be address before merge and we can request a extra commit added to the branch before making another pull request. Besides this small issue I believe this is much better then the current process of adding a build number into openbor (current process we do not add a build number into source code). If you are happy with this I will continue work to incorporate this to our github repository and instructions for developers to use this process.
my pre-commit hook:
This will be updated to suite our engine.
As you requested I have made a git hook that will record what should be the build number by recording the master branch commit count then adding the current branch's commits ahead of master so when merged you should get the correct build number matching the commit count on master after the merge.
There is a small window of error if two pull requests are made at the same time but as all pull requests have to be reviewed this can be address before merge and we can request a extra commit added to the branch before making another pull request. Besides this small issue I believe this is much better then the current process of adding a build number into openbor (current process we do not add a build number into source code). If you are happy with this I will continue work to incorporate this to our github repository and instructions for developers to use this process.
my pre-commit hook:
Code:
#!/bin/sh
#pre-hook to log master commit count then add branch ahead of master and record into a build_number.h file.
countM=$(git rev-list master --count) #master commit count
countB=$(($(git rev-list master.. --count) + 2)) #branch ahead of master commit count +1 for the merge +1 for this commit.
echo $(($countM + $countB)) > build_number.h
git add build_number.h
exit 0
This will be updated to suite our engine.