File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -119,19 +119,22 @@ def commit(
119119 f .write (message .encode ("utf-8" ))
120120 f .close ()
121121
122- command = f'git commit { args } -F "{ f .name } "'
123-
124- if committer_date and os .name == "nt" : # pragma: no cover
125- # Using `cmd /v /c "{command}"` sets environment variables only for that command
126- command = f'cmd /v /c "set GIT_COMMITTER_DATE={ committer_date } && { command } "'
127- elif committer_date :
128- command = f"GIT_COMMITTER_DATE={ committer_date } { command } "
129-
122+ command = _get_commit_command (args , committer_date , f .name )
130123 c = cmd .run (command )
131124 os .unlink (f .name )
132125 return c
133126
134127
128+ def _get_commit_command (args : str , committer_date : str | None , name : str ) -> str :
129+ command = f'git commit { args } -F "{ name } "'
130+ if not committer_date :
131+ return command
132+ if os .name != "nt" :
133+ return f"GIT_COMMITTER_DATE={ committer_date } { command } "
134+ # Using `cmd /v /c "{command}"` sets environment variables only for that command
135+ return f'cmd /v /c "set GIT_COMMITTER_DATE={ committer_date } && { command } "'
136+
137+
135138def get_commits (
136139 start : str | None = None ,
137140 end : str = "HEAD" ,
You can’t perform that action at this time.
0 commit comments