From b6f20eebc4a78135a5d2cee88cf3501fbe6f2fea Mon Sep 17 00:00:00 2001 From: Jason Mansour Date: Fri, 11 Nov 2022 21:41:36 +0100 Subject: [PATCH 1/3] Specify initial branch in tests Without this, when a user changes the default branch name with git config --global init.defaultBranch main the tests would fail. --- tests/repohelpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/repohelpers.py b/tests/repohelpers.py index 9a83dfb8..dabd9762 100644 --- a/tests/repohelpers.py +++ b/tests/repohelpers.py @@ -18,7 +18,7 @@ def __init__(self, path=None): def __enter__(self): os.makedirs(self.path, exist_ok=True) - self.git('init', '--bare') + self.git('init', '--bare', '--initial-branch=master') return self def __exit__(self, *args): From 606357053e95c72bbe38701c315f3bdb090dc350 Mon Sep 17 00:00:00 2001 From: Jason Mansour Date: Fri, 11 Nov 2022 21:46:17 +0100 Subject: [PATCH 2/3] Use C locale when parsing git output Setting LANG=C so that on non-English systems, the output of git is consistent. --- nbgitpuller/pull.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nbgitpuller/pull.py b/nbgitpuller/pull.py index 2b74b4b4..842c9708 100644 --- a/nbgitpuller/pull.py +++ b/nbgitpuller/pull.py @@ -16,6 +16,7 @@ def execute_cmd(cmd, **kwargs): yield '$ {}\n'.format(' '.join(cmd)) kwargs['stdout'] = subprocess.PIPE kwargs['stderr'] = subprocess.STDOUT + kwargs['env'] = dict(os.environ, LANG='C') proc = subprocess.Popen(cmd, **kwargs) From f6107d9f45038c680b45263db157224feec60080 Mon Sep 17 00:00:00 2001 From: Jason Mansour Date: Mon, 14 Nov 2022 12:52:25 +0100 Subject: [PATCH 3/3] Explain why we change the git locale to C Co-authored-by: Yuvi Panda --- nbgitpuller/pull.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nbgitpuller/pull.py b/nbgitpuller/pull.py index 842c9708..dd085e64 100644 --- a/nbgitpuller/pull.py +++ b/nbgitpuller/pull.py @@ -16,6 +16,8 @@ def execute_cmd(cmd, **kwargs): yield '$ {}\n'.format(' '.join(cmd)) kwargs['stdout'] = subprocess.PIPE kwargs['stderr'] = subprocess.STDOUT + # Explicitly set LANG=C, as `git` commandline output will be different if + # the user environment has a different locale set! kwargs['env'] = dict(os.environ, LANG='C') proc = subprocess.Popen(cmd, **kwargs)