File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -449,3 +449,27 @@ def test_git_commit_from_rev_and_commit():
449449 assert commit .author == "John Doe"
450450 assert commit .author_email == "john@example.com"
451451 assert commit .parents == []
452+
453+
454+ @pytest .mark .parametrize (
455+ "os_name,committer_date,expected_cmd" ,
456+ [
457+ (
458+ "nt" ,
459+ "2024-03-20" ,
460+ 'cmd /v /c "set GIT_COMMITTER_DATE=2024-03-20&& git commit -F "temp.txt""' ,
461+ ),
462+ (
463+ "posix" ,
464+ "2024-03-20" ,
465+ 'GIT_COMMITTER_DATE=2024-03-20 git commit -F "temp.txt"' ,
466+ ),
467+ ("nt" , None , 'git commit -F "temp.txt"' ),
468+ ("posix" , None , 'git commit -F "temp.txt"' ),
469+ ],
470+ )
471+ def test_create_commit_cmd_string (mocker , os_name , committer_date , expected_cmd ):
472+ """Test the OS-specific behavior of _create_commit_cmd_string"""
473+ mocker .patch ("os.name" , os_name )
474+ result = git ._create_commit_cmd_string ("" , committer_date , "temp.txt" )
475+ assert result == expected_cmd
You can’t perform that action at this time.
0 commit comments