From c4129d5777c1d2f8afdf0afc050d44283283cc97 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Mon, 6 Nov 2023 03:13:58 -0800 Subject: [PATCH 1/3] Improve consistensy of names and add bare-bones Python gitignore --- .github/workflows/ci.yml | 4 +++- .gitignore | 2 ++ tests/{test_archive_file.py => test_git_archive_file.py} | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 .gitignore rename tests/{test_archive_file.py => test_git_archive_file.py} (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2282331f5..45d265207 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + ref: 'main' - name: Set up Python 3.10 uses: actions/setup-python@v4 with: diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..a230a78ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.venv/ +__pycache__/ diff --git a/tests/test_archive_file.py b/tests/test_git_archive_file.py similarity index 95% rename from tests/test_archive_file.py rename to tests/test_git_archive_file.py index 5ca486004..615a35580 100644 --- a/tests/test_archive_file.py +++ b/tests/test_git_archive_file.py @@ -28,8 +28,8 @@ def test_archive_file_on_any_not_tags_branch_without_default_branch(self, temp_r def test_archive_file_on_any_not_tags_branch_with_default_branch(self, temp_repo): git = temp_repo.get_repo_git() - git.checkout("master") - git.config("git-extras.default-branch", "master") + git.checkout("main") + git.config("git-extras.default-branch", "main") temp_repo.invoke_installed_extras_command("archive-file") filename = "{0}.{1}.zip".format( temp_repo.get_repo_dirname(), @@ -53,13 +53,13 @@ def test_archive_file_on_dirname_has_backslash(self, named_temp_repo): filename = "{0}.{1}.{2}.zip".format( "backslash-dir", git.describe("--always", "--long"), - "master") + "main") assert filename in os.listdir() def test_archive_file_on_tag_name_has_slash(self, temp_repo): temp_repo.switch_cwd_under_repo() git = temp_repo.get_repo_git() - git.checkout("master") + git.checkout("main") git.tag("--delete", "0.1.0") git.tag("0.1.0/slash", "-m", "bump: 0.1.0") temp_repo.invoke_installed_extras_command("archive-file") From c6882bdb103a95fad289d4690959052ee2fc92e4 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Tue, 7 Nov 2023 09:23:28 -0800 Subject: [PATCH 2/3] Fix `init.defaultBranch` issue --- .editorconfig | 3 +++ tests/helper.py | 2 +- tests/test_git_archive_file.py | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index 873470a60..bc1a4e7c0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,6 @@ trim_trailing_whitespace = false [*.html] trim_trailing_whitespace = false + +[*.py] +indent_size = 4 diff --git a/tests/helper.py b/tests/helper.py index aec6cbca6..66ffa81ee 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -18,7 +18,7 @@ def __init__(self, repo_work_dir = None): repo_work_dir = os.path.join(self._system_tmpdir, repo_work_dir) self._cwd = repo_work_dir self._tempdirname = self._cwd[len(self._system_tmpdir) + 1:] - self._git_repo = git.Repo.init(repo_work_dir) + self._git_repo = git.Repo.init(repo_work_dir, b="default") self._files = [] def switch_cwd_under_repo(self): diff --git a/tests/test_git_archive_file.py b/tests/test_git_archive_file.py index 615a35580..687432221 100644 --- a/tests/test_git_archive_file.py +++ b/tests/test_git_archive_file.py @@ -28,8 +28,8 @@ def test_archive_file_on_any_not_tags_branch_without_default_branch(self, temp_r def test_archive_file_on_any_not_tags_branch_with_default_branch(self, temp_repo): git = temp_repo.get_repo_git() - git.checkout("main") - git.config("git-extras.default-branch", "main") + git.checkout("default") + git.config("git-extras.default-branch", "default") temp_repo.invoke_installed_extras_command("archive-file") filename = "{0}.{1}.zip".format( temp_repo.get_repo_dirname(), @@ -53,13 +53,13 @@ def test_archive_file_on_dirname_has_backslash(self, named_temp_repo): filename = "{0}.{1}.{2}.zip".format( "backslash-dir", git.describe("--always", "--long"), - "main") + "default") assert filename in os.listdir() def test_archive_file_on_tag_name_has_slash(self, temp_repo): temp_repo.switch_cwd_under_repo() git = temp_repo.get_repo_git() - git.checkout("main") + git.checkout("default") git.tag("--delete", "0.1.0") git.tag("0.1.0/slash", "-m", "bump: 0.1.0") temp_repo.invoke_installed_extras_command("archive-file") From 80269fb5d185a939ba126c5010e94a5a8e693374 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Tue, 7 Nov 2023 09:26:26 -0800 Subject: [PATCH 3/3] ci: try thing --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45d265207..810008dbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,8 +43,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - ref: 'main' - name: Set up Python 3.10 uses: actions/setup-python@v4 with: