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
|
||||
# the git id
|
||||
gitversion() {
|
||||
export GIT_DIR="$1"
|
||||
export GIT_DIR="$1/.git"
|
||||
|
||||
# This verifies we are in a git directory
|
||||
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
|
||||
mod="M"
|
||||
# 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"
|
||||
elif git diff --name-only --cached HEAD | read dummy; then
|
||||
mod="M"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${version}${mod}"
|
||||
# All done with git
|
||||
|
@ -69,7 +72,7 @@ if [ -r $TOP/$VERSIONFILE ]; then VER=`cat $TOP/$VERSIONFILE`;
|
|||
else
|
||||
# Ok, we need to derive it from the Version Control system
|
||||
if [ -d "$TOP/.git" ]; then
|
||||
VER=`gitversion $TOP/.git`
|
||||
VER=`gitversion $TOP`
|
||||
else
|
||||
VER=`svnversion_safe $TOP`;
|
||||
if [ "$VER" = "unknown" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue