88def git_repo (tmp_path : Path ) -> Path :
99 repo_path = tmp_path / "test_repo"
1010 repo_path .mkdir ()
11- subprocess .run (["git" , "init" ], cwd = repo_path , check = True , capture_output = True )
11+ subprocess .run (["git" , "init" , "-b" , "main" ], cwd = repo_path , check = True , capture_output = True )
1212 return repo_path
1313
1414
@@ -19,7 +19,7 @@ def test_git_uncommitted_changes(git_repo: Path):
1919 test_file .write_text ("SELECT 1 AS a" )
2020 subprocess .run (["git" , "add" , "model.sql" ], cwd = git_repo , check = True , capture_output = True )
2121 subprocess .run (
22- ["git" , "commit" , "-m" , "onitial commit" ],
22+ ["git" , "commit" , "-m" , "Initial commit" ],
2323 cwd = git_repo ,
2424 check = True ,
2525 capture_output = True ,
@@ -48,7 +48,7 @@ def test_git_both_staged_and_unstaged_changes(git_repo: Path):
4848 file2 .write_text ("SELECT 2" )
4949 subprocess .run (["git" , "add" , "." ], cwd = git_repo , check = True , capture_output = True )
5050 subprocess .run (
51- ["git" , "commit" , "-m" , "onitial commit" ],
51+ ["git" , "commit" , "-m" , "Initial commit" ],
5252 cwd = git_repo ,
5353 check = True ,
5454 capture_output = True ,
@@ -58,7 +58,7 @@ def test_git_both_staged_and_unstaged_changes(git_repo: Path):
5858 file1 .write_text ("SELECT 10" )
5959 subprocess .run (["git" , "add" , "model1.sql" ], cwd = git_repo , check = True , capture_output = True )
6060
61- # mdify file2 but don't stage it!
61+ # modify file2 but don't stage it!
6262 file2 .write_text ("SELECT 20" )
6363
6464 # both should be detected
@@ -99,20 +99,11 @@ def test_git_committed_changes(git_repo: Path):
9999 test_file .write_text ("SELECT 1" )
100100 subprocess .run (["git" , "add" , "model.sql" ], cwd = git_repo , check = True , capture_output = True )
101101 subprocess .run (
102- ["git" , "commit" , "-m" , "onitial commit" ],
103- cwd = git_repo ,
104- check = True ,
105- capture_output = True ,
106- )
107-
108- result = subprocess .run (
109- ["git" , "branch" , "--show-current" ],
102+ ["git" , "commit" , "-m" , "Initial commit" ],
110103 cwd = git_repo ,
111104 check = True ,
112105 capture_output = True ,
113- text = True ,
114106 )
115- default_branch = result .stdout .strip ()
116107
117108 subprocess .run (
118109 ["git" , "checkout" , "-b" , "feature" ],
@@ -130,7 +121,7 @@ def test_git_committed_changes(git_repo: Path):
130121 capture_output = True ,
131122 )
132123
133- committed = git_client .list_committed_changed_files (target_branch = default_branch )
124+ committed = git_client .list_committed_changed_files (target_branch = "main" )
134125 assert len (committed ) == 1
135126 assert committed [0 ].name == "model.sql"
136127
0 commit comments