mix.exs: proper check on 0, remove else in git_pre_release
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 23 Apr 2020 22:26:24 +0000 (00:26 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 23 Apr 2020 22:45:12 +0000 (00:45 +0200)
mix.exs

diff --git a/mix.exs b/mix.exs
index 15a65c0fbdf254192b880cbf7babf5671796a340..ebb8bdb08fbeaf13ff43fd989626eca717df6d26 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -220,10 +220,10 @@ defmodule Pleroma.Mixfile do
   defp version(version) do
     identifier_filter = ~r/[^0-9a-z\-]+/i
 
-    {_gitpath, git_present} = System.cmd("sh", ["-c", "command -v git"])
+    {_cmdgit, cmdgit_err} = System.cmd("sh", ["-c", "command -v git"])
 
     git_pre_release =
-      if git_present do
+      if cmdgit_err == 0 do
         {tag, tag_err} =
           System.cmd("git", ["describe", "--tags", "--abbrev=0"], stderr_to_stdout: true)
 
@@ -243,15 +243,13 @@ defmodule Pleroma.Mixfile do
             "0-g" <> String.trim(commit_hash)
 
           true ->
-            ""
+            nil
         end
-      else
-        ""
       end
 
     # Branch name as pre-release version component, denoted with a dot
     branch_name =
-      with true <- git_present,
+      with 0 <- cmdgit_err,
            {branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]),
            branch_name <- String.trim(branch_name),
            branch_name <- System.get_env("PLEROMA_BUILD_BRANCH") || branch_name,