From cfe47b7686df0c4c87270a83d6d7f933323ed7e6 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 1 Apr 2021 11:11:07 +0200 Subject: [PATCH] Fixed #32610 -- Fixed get_git_changeset() on Linux. shell=True is required on Windows. Unfortunately passing a sequence to subprocess.run() behaves differently on Linux, i.e. the first item specifies the command string, and any additional items are treated as additional arguments to the shell itself. https://docs.python.org/3.9/library/subprocess.html#subprocess.Popen https://docs.python.org/3.9/library/subprocess.html#converting-an-argument-sequence-to-a-string-on-windows Regression in a44d80f88e22eda24dacef48e368895ebea96635. --- django/utils/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/utils/version.py b/django/utils/version.py index 54b10e89d7..50be432942 100644 --- a/django/utils/version.py +++ b/django/utils/version.py @@ -79,7 +79,7 @@ def get_git_changeset(): """ repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) git_log = subprocess.run( - ['git', 'log', '--pretty=format:%ct', '--quiet', '-1', 'HEAD'], + 'git log --pretty=format:%ct --quiet -1 HEAD', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, cwd=repo_dir, universal_newlines=True, )