check if modern git is used

This commit is contained in:
Matthias committed 2022-02-28 00:23:46 +01:00
1 parent 8550915528
commit 1591597ef9
1 file changed
+4 -1
+4 -1
View File
@@ -94,9 +94,12 @@ def get_git_log(path):
""" """
Get dict with info of the last commit to file named in path Get dict with info of the last commit to file named in path
""" """
from plugin import registry
output = None
if registry.git_is_modern:
path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:] path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:]
command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path] command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path]
output = None
try: try:
output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1] output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1]
if output: if output: