File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -181,19 +181,22 @@ def commit(
181
181
f .write (message .encode ("utf-8" ))
182
182
f .close ()
183
183
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 )
192
185
c = cmd .run (command )
193
186
os .unlink (f .name )
194
187
return c
195
188
196
189
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
+
197
200
def get_commits (
198
201
start : str | None = None ,
199
202
end : str = "HEAD" ,
You can’t perform that action at this time.
0 commit comments