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 @@ -181,19 +181,22 @@ def commit(
181181 f .write (message .encode ("utf-8" ))
182182 f .close ()
183183
184- command = f'git commit { args } -F "{ f .name } "'
185-
186- if committer_date and os .name == "nt" : # pragma: no cover
187- # Using `cmd /v /c "{command}"` sets environment variables only for that command
188- command = f'cmd /v /c "set GIT_COMMITTER_DATE={ committer_date } && { command } "'
189- elif committer_date :
190- command = f"GIT_COMMITTER_DATE={ committer_date } { command } "
191-
184+ command = _create_commit_cmd_string (args , committer_date , f .name )
192185 c = cmd .run (command )
193186 os .unlink (f .name )
194187 return c
195188
196189
190+ def _create_commit_cmd_string (args : str , committer_date : str | None , name : str ) -> str :
191+ command = f'git commit { args } -F "{ name } "'
192+ if not committer_date :
193+ return command
194+ if os .name != "nt" :
195+ return f"GIT_COMMITTER_DATE={ committer_date } { command } "
196+ # Using `cmd /v /c "{command}"` sets environment variables only for that command
197+ return f'cmd /v /c "set GIT_COMMITTER_DATE={ committer_date } && { command } "'
198+
199+
197200def get_commits (
198201 start : str | None = None ,
199202 end : str = "HEAD" ,
You can’t perform that action at this time.
0 commit comments