From 873477c51b8165666cd966ae89feafd16e4ea621 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Feb 01 2022 19:52:02 +0000 Subject: git_sort: tests: Fix warning about default branch Since the version in SLE 15 git init prints this warning which is logged in the test result: hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch hint: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and hint: 'development'. The just-created branch can be renamed via this command: hint: hint: git branch -m The -b argument to git init to suppress this warning is not available on git versions that do not print the warning. pygit2.init_repository does not print this warning so use it instead. --- diff --git a/scripts/git_sort/tests/test_quilt_mode.py b/scripts/git_sort/tests/test_quilt_mode.py index 1b32e4a..2f00aea 100755 --- a/scripts/git_sort/tests/test_quilt_mode.py +++ b/scripts/git_sort/tests/test_quilt_mode.py @@ -168,7 +168,7 @@ Signed-off-by: Ingo Molnar content2 = f.read() self.assertEqual(content2, content1) - subprocess.check_call(("git", "init", "./",), stdout=subprocess.DEVNULL) + pygit2.init_repository("./") subprocess.check_call(("git", "add", "series.conf", "patches.suse",), stdout=subprocess.DEVNULL) subprocess.check_call(("git", "commit", "-m", "import",), @@ -460,7 +460,7 @@ class TestMergeTool(unittest.TestCase): self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") os.chdir(self.ks_dir) - subprocess.check_call(("git", "init", "./",), stdout=subprocess.DEVNULL) + pygit2.init_repository("./") subprocess.check_call( ("git", "config", "--add", "mergetool.git-sort.cmd", "%s $LOCAL $BASE $REMOTE $MERGED" % (