Raymond Toy pushed to branch issue-464-lisp-version-uses-branch-name at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • bin/git-version.sh
    ... ... @@ -37,16 +37,20 @@ if [ -n "$VERSION" ]; then
    37 37
         DEFAULT_VERSION="$VERSION"
    
    38 38
     else
    
    39 39
         # Get the current branch.
    
    40
    -    BRANCH="`git rev-parse --abbrev-ref HEAD`"
    
    40
    +    BRANCH="`git branch --show-current`"
    
    41 41
         if [ "$BRANCH" = "master" ]; then
    
    42 42
     	# On the master branch, use simple git describe --dirty for the version
    
    43 43
     	DEFAULT_VERSION="`git describe --dirty || git describe 2>/dev/null`"
    
    44
    +    elif [ -n "$BRANCH" ]; then
    
    45
    +	# We're on some branch.  Just use the branch name.
    
    46
    +	DEFAULT_VERSION="$BRANCH"
    
    44 47
         else
    
    45
    -	# We're not on the master branch.  Do something different.
    
    46
    -	# The option --all allows use to use the the branch name or tag
    
    47
    -	# name as appropriate.  This is much more informative.  However,
    
    48
    -	# we have to remove everything before the first slash which
    
    49
    -	# contains things like "tag/" or "head/".
    
    48
    +	# We're not on a branch.  We need to do something different.
    
    49
    +	# The option --all allows use to use the the branch name or
    
    50
    +	# tag name as appropriate.  This is much more informative.
    
    51
    +	# However, we have to remove everything before the first slash
    
    52
    +	# which contains things like "tags/", "head/", or "pipelines/"
    
    53
    +	# (from CI).
    
    50 54
     	GIT_DESC="`git describe --all --dirty || git describe 2>/dev/null`"
    
    51 55
     	GIT_HASH="`echo ${GIT_DESC} | sed 's;^[^/]*/;;' 2>/dev/null`"
    
    52 56
     
    
    ... ... @@ -68,7 +72,11 @@ else
    68 72
     		DEFAULT_VERSION="ci-${GIT_HASH}"
    
    69 73
     		;;
    
    70 74
     	    *)
    
    71
    -		# Everything else is taken as is.
    
    75
    +		# Use whatever we have.  This handles the case where
    
    76
    +		# we're checked on some git hash.  In that we we have
    
    77
    +		# "head/closest-branch-nn-gxxxxxx" where nn is the
    
    78
    +		# number of commits after the closest branch and
    
    79
    +		# xxxxxx is the git hash.
    
    72 80
     		DEFAULT_VERSION="${GIT_HASH}"
    
    73 81
     		;;
    
    74 82
     	esac