mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
check if modern git is used
This commit is contained in:
parent
8550915528
commit
1591597ef9
@ -94,15 +94,18 @@ 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
|
||||||
"""
|
"""
|
||||||
path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:]
|
from plugin import registry
|
||||||
command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path]
|
|
||||||
output = None
|
output = None
|
||||||
try:
|
if registry.git_is_modern:
|
||||||
output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1]
|
path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:]
|
||||||
if output:
|
command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path]
|
||||||
output = output.split('\n')
|
try:
|
||||||
except subprocess.CalledProcessError: # pragma: no cover
|
output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1]
|
||||||
pass
|
if output:
|
||||||
|
output = output.split('\n')
|
||||||
|
except subprocess.CalledProcessError: # pragma: no cover
|
||||||
|
pass
|
||||||
|
|
||||||
if not output:
|
if not output:
|
||||||
output = 7 * [''] # pragma: no cover
|
output = 7 * [''] # pragma: no cover
|
||||||
|
Loading…
Reference in New Issue
Block a user