@@ -281,7 +281,7 @@ def generate_patch(
281281
282282 pathspec_fd , pathspec_path = tempfile .mkstemp (prefix = "render-check-" , suffix = ".txt" )
283283 with os .fdopen (pathspec_fd , "w" ) as f :
284- f .write ("\n " .join (paths ))
284+ f .write ("\n " .join (paths ) + " \n " )
285285
286286 extra_pathspec_path : str | None = None
287287 try :
@@ -291,12 +291,19 @@ def generate_patch(
291291 prefix = "render-check-extra-" , suffix = ".txt"
292292 )
293293 with os .fdopen (extra_fd , "w" ) as f :
294- f .write ("\n " .join (extra_files ))
295- subprocess .run (
296- ["git" , "add" , "-N" , "--pathspec-from-file" , extra_pathspec_path ],
297- check = True ,
298- capture_output = True ,
299- )
294+ f .write ("\n " .join (extra_files ) + "\n " )
295+ try :
296+ subprocess .run (
297+ ["git" , "add" , "-N" , "--pathspec-from-file" , extra_pathspec_path ],
298+ check = True ,
299+ capture_output = True ,
300+ )
301+ except subprocess .CalledProcessError as exc :
302+ stderr = (exc .stderr or b"" ).decode ("utf-8" , errors = "replace" ).strip ()
303+ print (
304+ f"::warning::git add -N failed: exit={ exc .returncode } : { stderr } " ,
305+ file = sys .stderr ,
306+ )
300307
301308 try :
302309 result = subprocess .run (
@@ -306,8 +313,9 @@ def generate_patch(
306313 )
307314 patch = result .stdout
308315 except subprocess .CalledProcessError as exc :
316+ stderr = (exc .stderr or b"" ).decode ("utf-8" , errors = "replace" ).strip ()
309317 print (
310- f"::warning::git diff failed while generating patch: { exc } " ,
318+ f"::warning::git diff failed while generating patch: exit= { exc . returncode } : { stderr } " ,
311319 file = sys .stderr ,
312320 )
313321 patch = b""
@@ -321,8 +329,9 @@ def generate_patch(
321329 capture_output = True ,
322330 )
323331 except subprocess .CalledProcessError as exc :
332+ stderr = (exc .stderr or b"" ).decode ("utf-8" , errors = "replace" ).strip ()
324333 print (
325- f"::warning::git reset (undo intent-to-add) failed: { exc } " ,
334+ f"::warning::git reset (undo intent-to-add) failed: exit= { exc . returncode } : { stderr } " ,
326335 file = sys .stderr ,
327336 )
328337 finally :
0 commit comments