GreenDjango / blih_cli

CLI for Blih
MIT License
6 stars 0 forks source link

[Bug] Snapshot versioning error #14

Closed YannMagnin closed 4 years ago

YannMagnin commented 4 years ago

Using blih_cli version 0.1.2

When I try to switch to the "snapshot" version of the project using blih_cli --snapshot I have this Git error message:

yann@xana /t/blih_cli (master)> blih_cli --snapshot
Fetch repo...
fatal: No tags can describe '5a5291cecd8da050cfd4f64d5bc1405e9d6dd61e'.
Try --always, or create some tags.
/usr/bin/blih_cli -> /usr/lib/node_modules/blih_cli/prod/index.js
/usr/bin/bcli -> /usr/lib/node_modules/blih_cli/prod/index.js
+ blih_cli@0.1.2
updated 1 package in 0.323s
Update to ->

And the blih_cli version displayed on the next execution is: v0.0.0

GreenDjango commented 4 years ago
# Get new tags from the remote
printf "Fetch repo...\n"
git fetch --tags
if [ "$1" == "snapshot" ]
then
    latest_tag=$(git rev-list --all --max-count=1)
else
    latest_tag=$(git rev-list --tags --max-count=1)
fi
if [ "$latest_tag" != "$current_tag" ]
then
    # Get the latest tag name, assign it to a variable
    latest_tag_name=$(git describe --tags $latest_tag)
    # Checkout the latest tag
    git reset --hard > /dev/null
    git checkout "$latest_tag" 2> /dev/null
...

Work for me. git fetch --tags can fail I guess (eg: network issue), but 5a5291... is the last commit so why git describe ... fail ?

GreenDjango commented 4 years ago

Ok git describe --tags $latest_tag fail because we use git clone --depth 1 in install.sh, so the git is shallow and don't have new tags/commits.