Merge pull request #4036 from JustAnotherArchivist/dev-version-detection

Verify that we're in the correct repository when extracting dev version information
This commit is contained in:
Maximilian Hils 2020-06-19 17:34:22 +02:00 committed by GitHub
commit 8e5c62c169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,13 @@ def get_dev_version() -> str:
here = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) here = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
try: try:
# Check that we're in the mitmproxy repository: https://github.com/mitmproxy/mitmproxy/issues/3987
subprocess.run(
['git', 'cat-file', '-t', 'cb0e3287090786fad566feb67ac07b8ef361b2c3'],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
cwd=here,
check=True)
git_describe = subprocess.check_output( git_describe = subprocess.check_output(
['git', 'describe', '--tags', '--long'], ['git', 'describe', '--tags', '--long'],
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,