Bash script that selects a Git tag fails since some days

We are facing continuously failing scripts in the last days. The arguments that we pass to scripts are ignored, which looks like something has changed on bash side.
This is a test with one of the scripts failing, it does not properly detect the arguments anymore.

Our implementation on reading the arguments, which we also use in other scripts (that are also failing now)

Any ideas what could have been changed?

Thanks, Markus

This code is at fault:

  if [ "latest" = "$TAG" ]; then
    LATEST_LOCAL_TAG=`(git tag -l | tail -1)`

Since Travis does a shallow clone by default, it can very well be that no tags are on the current branch within 50 commits from the tip. I’ve also seen this effect in PR branches from forks. Then git tag -l prints nothing, with the result that you see.

Also check out for an easy way to debug your Bash scripts.