From e6874c866d6aeeba482cfe33e7cfea08e2665003 Mon Sep 17 00:00:00 2001 From: Remo Rechkemmer <59358383+monacoremo@users.noreply.github.com> Date: Wed, 20 May 2020 21:10:53 +0200 Subject: [PATCH] Fix UNKNOWN being shown as git commit hash (#1533) Fixes https://github.com/PostgREST/postgrest/issues/1530 --- CHANGELOG.md | 2 ++ src/PostgREST/Config.hs | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 749d3e8c1..cd1de8f18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed + - #1530, Fix how the PostgREST version is shown in the help text when the `.git` directory is not available - @monacoremo + ## [7.0.1] - 2020-05-18 ### Fixed diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index 0761f3a65..903be95dd 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -124,8 +124,12 @@ corsPolicy req = case lookup "origin" headers of -- | User friendly version number prettyVersion :: Text prettyVersion = - intercalate "." (map show $ versionBranch version) - <> " (" <> take 7 $(gitHash) <> ")" + intercalate "." (map show $ versionBranch version) <> gitRev + where + gitRev = + if $(gitHash) == "UNKNOWN" + then mempty + else " (" <> take 7 $(gitHash) <> ")" -- | Version number used in docs docsVersion :: Text