Skip to content

Conversation

@bric3
Copy link
Contributor

@bric3 bric3 commented Jan 14, 2026

This should fix #1132

git-delete-merged-branch already checks if the branch is the default branch via git_extra_default_branch helper function, but the implementation only checked init.defaultBranch.

This new implementation goes further by looking in this order:

  1. Check explicit config git-extras.default-branch
  2. Remote HEAD auto-detection
  3. Check git's default branch config init.defaultBranch
  4. Common branch detection - Checks if main, master, trunk, default, development, stable, release, prod, production exist locally
  5. Fallback to main as last resort

Removed default as a default branch as it was breaking this test, so I preferred to back out.

@pytest.mark.parametrize("named_temp_repo", ["backslash\\dir"], indirect=True)
def test_archive_file_on_dirname_has_backslash(self, named_temp_repo):
named_temp_repo.invoke_installed_extras_command("archive-file")
git = named_temp_repo.get_repo_git()
filename = "{0}.{1}.{2}.zip".format(
"backslash-dir", git.describe("--always", "--long"), "default"
)
assert filename in os.listdir()

@bric3 bric3 marked this pull request as draft January 14, 2026 13:20
@bric3 bric3 force-pushed the prevent-master-deletion branch from de18c2d to f2729b6 Compare January 14, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git delete-merged-branches can delete default branch such as master

1 participant