From 08748dd0214b0368f73aa8e82931d9487cca54dd Mon Sep 17 00:00:00 2001 From: Joe Schr <8218910+TheJoeSchr@users.noreply.github.com> Date: Wed, 11 Jan 2023 21:07:03 +0100 Subject: [PATCH] fix "--version": needs to change working directory before calling `git`. otherwise it would display git commit id from the directory where you are calling `freqtrade` from instead of freqtrade's current commit id --- freqtrade/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index 5430cd2d0..09bfaab20 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -3,11 +3,13 @@ __version__ = '2023.1.dev' if 'dev' in __version__: try: + import os import subprocess + freqtrade_basedir = os.path.dirname(os.path.abspath(__file__)) __version__ = __version__ + '-' + subprocess.check_output( ['git', 'log', '--format="%h"', '-n 1'], - stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') + stderr=subprocess.DEVNULL, cwd=freqtrade_basedir).decode("utf-8").rstrip().strip('"') except Exception: # pragma: no cover # git not available, ignore