Xcode-Scripts/Git Version.sh
2011-04-21 11:18:03 -05:00

18 lines
530 B
Bash
Executable File

#!/bin/bash
#
# Git Version
#
# Created by Mr. Gecko <GRMrGecko@gmail.com> on 4/21/11.
# No Copyright Claimed. Public Domain.
#
INFO="${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Info"
GITDIR="${PROJECT_DIR}/.git"
VERSION=`defaults read "${INFO}" CFBundleVersion`
if [ -d "${GITDIR}" ]; then
REVISION=`git --git-dir="${GITDIR}" rev-parse --short HEAD`
defaults write "${INFO}" CFBundleShortVersionString -string "${VERSION} (${REVISION})"
else
defaults write "${INFO}" CFBundleShortVersionString -string "${VERSION}"
fi