Merge branch 'bugfix/mix-dotgit' into 'develop'

mix: Check `.git` presence

See merge request pleroma/pleroma!3638
This commit is contained in:
Haelwenn 2022-03-17 21:21:59 +00:00
commit 2db640632b

View file

@ -243,9 +243,10 @@ defp version(version) do
identifier_filter = ~r/[^0-9a-z\-]+/i identifier_filter = ~r/[^0-9a-z\-]+/i
git_available? = match?({_output, 0}, System.cmd("sh", ["-c", "command -v git"])) git_available? = match?({_output, 0}, System.cmd("sh", ["-c", "command -v git"]))
dotgit_present? = File.exists?(".git")
git_pre_release = git_pre_release =
if git_available? do if git_available? and dotgit_present? do
{tag, tag_err} = {tag, tag_err} =
System.cmd("git", ["describe", "--tags", "--abbrev=0"], stderr_to_stdout: true) System.cmd("git", ["describe", "--tags", "--abbrev=0"], stderr_to_stdout: true)
@ -272,6 +273,7 @@ defp version(version) do
# Branch name as pre-release version component, denoted with a dot # Branch name as pre-release version component, denoted with a dot
branch_name = branch_name =
with true <- git_available?, with true <- git_available?,
true <- dotgit_present?,
{branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]), {branch_name, 0} <- System.cmd("git", ["rev-parse", "--abbrev-ref", "HEAD"]),
branch_name <- String.trim(branch_name), branch_name <- String.trim(branch_name),
branch_name <- System.get_env("PLEROMA_BUILD_BRANCH") || branch_name, branch_name <- System.get_env("PLEROMA_BUILD_BRANCH") || branch_name,