From 0f5dc0b4e273f4114b0134ef39c838959b0f0592 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 27 Jan 2019 18:32:37 -0800 Subject: [PATCH] Add --stdout param to git_version_gen.sh This causes git_version_gen.sh to print to stdout. --- build_tools/git_version_gen.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build_tools/git_version_gen.sh b/build_tools/git_version_gen.sh index 6f30cd65f..86132888e 100755 --- a/build_tools/git_version_gen.sh +++ b/build_tools/git_version_gen.sh @@ -8,10 +8,6 @@ set -e # Find the fish git directory as two levels up from script directory. GIT_DIR="$( cd "$( dirname $( dirname "$0" ) )" && pwd )" - -# Set the output directory as either the first param or cwd. -test -n "$1" && OUTPUT_DIR=$1/ || OUTPUT_DIR= -FBVF=${OUTPUT_DIR}FISH-BUILD-VERSION-FILE DEF_VER=unknown # First see if there is a version file (included in release tarballs), @@ -23,6 +19,17 @@ elif ! VN=$(git -C "$GIT_DIR" describe --always --dirty 2>/dev/null); then VN="$DEF_VER" fi +# If the first param is --stdout, then output to stdout and exit. +if test "$1" = '--stdout' +then + echo $VN + exit 0 +fi + +# Set the output directory as either the first param or cwd. +test -n "$1" && OUTPUT_DIR=$1/ || OUTPUT_DIR= +FBVF=${OUTPUT_DIR}FISH-BUILD-VERSION-FILE + if test -r $FBVF then VC=$(grep -v '^#' $FBVF | tr -d '"' | sed -e 's/^FISH_BUILD_VERSION=//')