Merge pull request #4039 from JustAnotherArchivist/dev-version-detection-2

Replace git cat-file -t with -e and explain the magic ID
This commit is contained in:
Thomas Kriechbaumer 2020-06-22 13:55:36 +02:00 committed by GitHub
commit 0793f61496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,8 +21,9 @@ 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 # Check that we're in the mitmproxy repository: https://github.com/mitmproxy/mitmproxy/issues/3987
# cb0e3287090786fad566feb67ac07b8ef361b2c3 is the first mitmproxy commit.
subprocess.run( subprocess.run(
['git', 'cat-file', '-t', 'cb0e3287090786fad566feb67ac07b8ef361b2c3'], ['git', 'cat-file', '-e', 'cb0e3287090786fad566feb67ac07b8ef361b2c3'],
stdout=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
cwd=here, cwd=here,