diff --git a/fml/getversion.py b/fml/getversion.py index 6f53c7154..8f2f41cd1 100644 --- a/fml/getversion.py +++ b/fml/getversion.py @@ -47,13 +47,16 @@ def main(): (mcpversion,mcclientversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups() - cmd = "git rev-parse --abbrev-ref HEAD" - try: - process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1) - branch, _ = process.communicate() - except OSError: - print("Git not found") - branch="none" + if os.getenv("GIT_BRANCH") is None: + cmd = "git rev-parse --abbrev-ref HEAD" + try: + process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1) + branch, _ = process.communicate() + except OSError: + print("Git not found") + branch="none" + else: + branch=os.getenv("GIT_BRANCH") with open("fmlversion.properties","w") as f: f.write("%s=%s\n" %("fmlbuild.major.number",major))