mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Add --stdout param to git_version_gen.sh
This causes git_version_gen.sh to print to stdout.
This commit is contained in:
parent
c869ab541d
commit
0f5dc0b4e2
1 changed files with 11 additions and 4 deletions
|
@ -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=//')
|
||||
|
|
Loading…
Reference in a new issue