From 6f4414e3f06a06b90f6350f6405e75b015a34807 Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Fri, 14 Jun 2019 11:20:49 +0530 Subject: [PATCH] version: Fail gracefully if git describe cannot get version. When running the `./tools/cache-zulip-git-version` script on Travis, the script fails because Travis gets a shallow clone of the repository, and not a full clone. This commit changes the script to fail gracefully, if we are unable to get the version information using `git describe`. When the command fails, it still writes an empty `zulip-git-version` and that has not been changed to keep creation of the release tarball simple, and avoiding a check for whether the file has any content. The code that sets `ZULIP_VERSION` checks whether the contents of the `zulip-git-version` file are empty, before setting `ZULIP_VERSION`. So, the version should never be set to an empty string. --- tools/cache-zulip-git-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cache-zulip-git-version b/tools/cache-zulip-git-version index 671062c3e6..40bfbef314 100755 --- a/tools/cache-zulip-git-version +++ b/tools/cache-zulip-git-version @@ -2,4 +2,4 @@ set -e cd "$(dirname "$0")/.." -git describe --tags > zulip-git-version +git describe --tags > zulip-git-version || true