diff --git a/lib/setup-prod-normal-user.bash b/lib/setup-prod-normal-user.bash index 7f017b2..36a14e7 100644 --- a/lib/setup-prod-normal-user.bash +++ b/lib/setup-prod-normal-user.bash @@ -45,6 +45,7 @@ function pull_repo { if git fetch origin $REPO_BRANCH --dry-run --verbose 2>&1 | grep -q " =.*\-> origin\/$REPO_BRANCH"; then set +Eue + show_repo_info $FORCE || exit 100 # means no change set -Eue fi @@ -83,6 +84,17 @@ function link_to_config { done } +function show_repo_info { + local git_local_branch=$(git rev-parse --abbrev-ref HEAD) + local git_current_version=$(git describe --tags 2>/dev/null | cut -d- -f1) + local git_ahead=$(git log "${git_current_version}"..HEAD --oneline | wc -l) + local git_dirty=$(git status -s | wc -l) + + [[ $git_ahead -gt 0 ]] && git_current_version="${git_current_version}⤽${git_ahead}" + [[ $git_dirty -gt 0 ]] && git_current_version="${git_current_version}…${git_dirty}" + echo "found version => [$git_local_branch] $git_current_version" +} + ## MAIN set -Eue assert_params $*