mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-29 13:42:33 +00:00
When computing git version run git commands in same dir as source files
This commit is contained in:
parent
d122e215ff
commit
aa577df064
@ -211,10 +211,12 @@ class SynapseHomeServer(HomeServer):
|
|||||||
|
|
||||||
def get_version_string():
|
def get_version_string():
|
||||||
null = open(os.devnull, 'w')
|
null = open(os.devnull, 'w')
|
||||||
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
||||||
try:
|
try:
|
||||||
git_branch = subprocess.check_output(
|
git_branch = subprocess.check_output(
|
||||||
['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
|
['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
|
||||||
stderr=null,
|
stderr=null,
|
||||||
|
cwd=cwd,
|
||||||
).strip()
|
).strip()
|
||||||
git_branch = "b=" + git_branch
|
git_branch = "b=" + git_branch
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
@ -224,6 +226,7 @@ def get_version_string():
|
|||||||
git_tag = subprocess.check_output(
|
git_tag = subprocess.check_output(
|
||||||
['git', 'describe', '--exact-match'],
|
['git', 'describe', '--exact-match'],
|
||||||
stderr=null,
|
stderr=null,
|
||||||
|
cwd=cwd,
|
||||||
).strip()
|
).strip()
|
||||||
git_tag = "t=" + git_tag
|
git_tag = "t=" + git_tag
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
@ -233,6 +236,7 @@ def get_version_string():
|
|||||||
git_commit = subprocess.check_output(
|
git_commit = subprocess.check_output(
|
||||||
['git', 'rev-parse', '--short', 'HEAD'],
|
['git', 'rev-parse', '--short', 'HEAD'],
|
||||||
stderr=null,
|
stderr=null,
|
||||||
|
cwd=cwd,
|
||||||
).strip()
|
).strip()
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
git_commit = ""
|
git_commit = ""
|
||||||
@ -242,6 +246,7 @@ def get_version_string():
|
|||||||
is_dirty = subprocess.check_output(
|
is_dirty = subprocess.check_output(
|
||||||
['git', 'describe', '--dirty=' + dirty_string],
|
['git', 'describe', '--dirty=' + dirty_string],
|
||||||
stderr=null,
|
stderr=null,
|
||||||
|
cwd=cwd,
|
||||||
).strip().endswith(dirty_string)
|
).strip().endswith(dirty_string)
|
||||||
|
|
||||||
git_dirty = "dirty" if is_dirty else ""
|
git_dirty = "dirty" if is_dirty else ""
|
||||||
|
Loading…
Reference in New Issue
Block a user