mix.exs: proper check on 0, remove else in git_pre_release

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-04-24 00:26:24 +02:00
parent c63d6ba0b2
commit 053c461530
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

10
mix.exs
View file

@ -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,