forked from len0rd/rockbox
Fix version.sh when it's run outside of the git working directory.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20934 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1de930227b
commit
6df03c6d53
1 changed files with 9 additions and 6 deletions
|
@ -34,7 +34,7 @@ svnversion_safe() {
|
||||||
# rockbox. If the commit information for HEAD has a svn-id in it we report that instead of
|
# rockbox. If the commit information for HEAD has a svn-id in it we report that instead of
|
||||||
# the git id
|
# the git id
|
||||||
gitversion() {
|
gitversion() {
|
||||||
export GIT_DIR="$1"
|
export GIT_DIR="$1/.git"
|
||||||
|
|
||||||
# This verifies we are in a git directory
|
# This verifies we are in a git directory
|
||||||
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
||||||
|
@ -46,11 +46,14 @@ gitversion() {
|
||||||
if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then
|
if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then
|
||||||
mod="M"
|
mod="M"
|
||||||
# Are there uncommitted changes?
|
# Are there uncommitted changes?
|
||||||
elif git diff --name-only HEAD | read dummy; then
|
else
|
||||||
|
export GIT_WORK_TREE="$1"
|
||||||
|
if git diff --name-only HEAD | read dummy; then
|
||||||
mod="M"
|
mod="M"
|
||||||
elif git diff --name-only --cached HEAD | read dummy; then
|
elif git diff --name-only --cached HEAD | read dummy; then
|
||||||
mod="M"
|
mod="M"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "${version}${mod}"
|
echo "${version}${mod}"
|
||||||
# All done with git
|
# All done with git
|
||||||
|
@ -69,7 +72,7 @@ if [ -r $TOP/$VERSIONFILE ]; then VER=`cat $TOP/$VERSIONFILE`;
|
||||||
else
|
else
|
||||||
# Ok, we need to derive it from the Version Control system
|
# Ok, we need to derive it from the Version Control system
|
||||||
if [ -d "$TOP/.git" ]; then
|
if [ -d "$TOP/.git" ]; then
|
||||||
VER=`gitversion $TOP/.git`
|
VER=`gitversion $TOP`
|
||||||
else
|
else
|
||||||
VER=`svnversion_safe $TOP`;
|
VER=`svnversion_safe $TOP`;
|
||||||
if [ "$VER" = "unknown" ]; then
|
if [ "$VER" = "unknown" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue