Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh36
1 files changed, 18 insertions, 18 deletions
diff --git a/version.sh b/version.sh
index ff902b152..76fc731c2 100755
--- a/version.sh
+++ b/version.sh
@@ -17,9 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
versionfile_fixed="./include/version.h"
-versionfile="./include/version_rev.h"
+versionfile="./build/version_rev.h"
manifestfile="./src/mpc-hc/res/mpc-hc.exe.manifest"
+[[ "$1" == "--quiet" ]] && quiet="yes" || quiet=""
+
# Read major, minor and patch version numbers from static version.h file
while read -r _ var value; do
if [[ $var == MPC_VERSION_MAJOR ]]; then
@@ -31,7 +33,7 @@ while read -r _ var value; do
fi
done < "$versionfile_fixed"
ver_fixed="${ver_fixed_major}.${ver_fixed_minor}.${ver_fixed_patch}"
-echo "Version: $ver_fixed"
+[[ -z "$quiet" ]] && echo "Version: $ver_fixed"
# If we are not inside a git repo use hardcoded values
if ! git rev-parse --git-dir > /dev/null 2>&1; then
@@ -41,41 +43,39 @@ if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo "Warning: Git not available or not a git repo. Using dummy values for hash and version number."
else
# Get information about the current version
- describe=$(git describe --long)
- echo "Describe: $describe"
+ describe=$(git describe --long --dirty)
+ [[ -z "$quiet" ]] && echo "Describe: $describe"
# Get the abbreviated hash of the current changeset
hash=${describe##*-g}
# Get the number changesets since the last tag
ver=${describe#*-}
- ver=${ver%-*}
+ ver=${ver%-g*}
ver_additional=" ($hash)"
# Get the current branch name
branch=$(git symbolic-ref -q HEAD) && branch=${branch##refs/heads/} || branch="no branch"
- echo "On branch: $branch"
- echo "Hash: $hash"
- if ! git diff-index --quiet HEAD; then
- echo "Revision: $ver (Local modifications found)"
- else
+ if [[ -z "$quiet" ]]; then
+ echo "On branch: $branch"
+ echo "Hash: $hash"
echo "Revision: $ver"
fi
- # If we are on another branch that isn't master, we want extra info like on
- # which commit from master it is based on. This assumes we
+ # If we are on another branch that isn't develop or master, we want extra info like on
+ # which commit from develop it is based on. This assumes we
# won't ever branch from a changeset from before the move to git
- if [[ "$branch" != "master" ]]; then
+ if [ "$branch" != "develop" ] && [ "$branch" != "master" ]; then
version_info="#define MPCHC_BRANCH _T(\"$branch\")"$'\n'
ver_additional+=" ($branch)"
- if git show-ref --verify --quiet refs/heads/master; then
- # Get where the branch is based on master
- base=$(git merge-base master HEAD)
+ if git show-ref --verify --quiet refs/heads/develop; then
+ # Get where the branch is based on develop
+ base=$(git merge-base develop HEAD)
base=${base:0:7}
- ver_additional+=" (master@${base})"
- echo "Mergebase: master@${base}"
+ ver_additional+=" (develop@${base})"
+ [[ -z "$quiet" ]] && echo "Mergebase: develop@${base}"
fi
fi
fi