From 1b5f64e7e4620a9695af4a9d5d2e4506c4e39738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Martins?= Date: Wed, 10 Dec 2025 10:11:46 +1100 Subject: [PATCH] Fix test_git_diff to use dynamic branch name --- src/git/tests/test_server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/git/tests/test_server.py b/src/git/tests/test_server.py index a7b4f88613..c852d1f7ce 100644 --- a/src/git/tests/test_server.py +++ b/src/git/tests/test_server.py @@ -143,13 +143,15 @@ def test_git_diff_staged_empty(test_repository): assert result == "" def test_git_diff(test_repository): + # Get the default branch name (could be "main" or "master") + default_branch = test_repository.active_branch.name test_repository.git.checkout("-b", "feature-diff") file_path = Path(test_repository.working_dir) / "test.txt" file_path.write_text("feature changes") test_repository.index.add(["test.txt"]) test_repository.index.commit("feature commit") - result = git_diff(test_repository, "master") + result = git_diff(test_repository, default_branch) assert "test.txt" in result assert "feature changes" in result