Skip to content

Commit

Permalink
detect when we are within a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Aug 28, 2019
1 parent eb5c1d5 commit f6b1235
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sbin/exabgp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh

GIT_TAG=`git status | egrep 'detached at 3|4' | wc -l`
git status 2> /dev/null > /dev/null

# returns 128 if not in a git repo
# returns 127 if git is not installed

if [ $? -eq 0 ]; then
if [ $? -eq 0 ] && [ $GIT_TAG -eq 0 ]; then
GIT_BRANCH=`git branch | grep "*" | awk '{ print $2}'`
GIT_COMMIT=`git log -1 | head -1 | awk '{ print $2 }'`
export EXABGP_VERSION="${GIT_BRANCH}-${GIT_COMMIT}"
Expand Down

0 comments on commit f6b1235

Please sign in to comment.