Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
b39ca49d
Unverified
Commit
b39ca49d
authored
5 years ago
by
Andrew Morgan
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle FileNotFound error in checking git repository version (#6284)
parent
770d1ef6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/6284.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/6284.bugfix
synapse/util/versionstring.py
+6
-4
6 additions, 4 deletions
synapse/util/versionstring.py
with
7 additions
and
4 deletions
changelog.d/6284.bugfix
0 → 100644
+
1
−
0
View file @
b39ca49d
Prevent errors from appearing on Synapse startup if `git` is not installed.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/util/versionstring.py
+
6
−
4
View file @
b39ca49d
...
...
@@ -42,6 +42,7 @@ def get_version_string(module):
try
:
null
=
open
(
os
.
devnull
,
"
w
"
)
cwd
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
module
.
__file__
))
try
:
git_branch
=
(
subprocess
.
check_output
(
...
...
@@ -51,7 +52,8 @@ def get_version_string(module):
.
decode
(
"
ascii
"
)
)
git_branch
=
"
b=
"
+
git_branch
except
subprocess
.
CalledProcessError
:
except
(
subprocess
.
CalledProcessError
,
FileNotFoundError
):
# FileNotFoundError can arise when git is not installed
git_branch
=
""
try
:
...
...
@@ -63,7 +65,7 @@ def get_version_string(module):
.
decode
(
"
ascii
"
)
)
git_tag
=
"
t=
"
+
git_tag
except
subprocess
.
CalledProcessError
:
except
(
subprocess
.
CalledProcessError
,
FileNotFoundError
)
:
git_tag
=
""
try
:
...
...
@@ -74,7 +76,7 @@ def get_version_string(module):
.
strip
()
.
decode
(
"
ascii
"
)
)
except
subprocess
.
CalledProcessError
:
except
(
subprocess
.
CalledProcessError
,
FileNotFoundError
)
:
git_commit
=
""
try
:
...
...
@@ -89,7 +91,7 @@ def get_version_string(module):
)
git_dirty
=
"
dirty
"
if
is_dirty
else
""
except
subprocess
.
CalledProcessError
:
except
(
subprocess
.
CalledProcessError
,
FileNotFoundError
)
:
git_dirty
=
""
if
git_branch
or
git_tag
or
git_commit
or
git_dirty
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment