You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/06/23 07:49:44 UTC
[incubator-nuttx] 04/04: tools/version.sh: Make it invokable from
everywhere
This is an automated email from the ASF dual-hosted git repository.
btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit f3c046175d46367e2c770565ab5312320ec82df2
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jun 23 06:33:43 2020 +0800
tools/version.sh: Make it invokable from everywhere
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
tools/version.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/version.sh b/tools/version.sh
index d5574d3..8467cbd 100755
--- a/tools/version.sh
+++ b/tools/version.sh
@@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-WD=`pwd`
+WD=$(dirname $0)
# Get command line parameters
@@ -86,7 +86,7 @@ done
OUTFILE=$1
if [ -z ${VERSION} ] ; then
- VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
+ VERSION=`git -C ${WD} tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
# Earlier tags used the format "major.minor", append a "0" for a patch.
@@ -133,12 +133,12 @@ PATCH=`echo ${VERSION} | cut -d'.' -f3`
# Get GIT information (if not provided on the command line)
if [ -z "${BUILD}" ]; then
- BUILD=`git log --oneline -1 | cut -d' ' -f1 2>/dev/null`
+ BUILD=`git -C ${WD} log --oneline -1 | cut -d' ' -f1 2>/dev/null`
if [ -z "${BUILD}" ]; then
echo "GIT version information is not available"
exit 5
fi
- if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then
+ if [ -n "`git -C ${WD} diff-index --name-only HEAD | head -1`" ]; then
BUILD=${BUILD}-dirty
fi
fi