@@ -86,15 +86,11 @@ const build_changes_markdown = (
8686 : undefined
8787
8888 let file_path : string | undefined
89- let is_deleted = false
9089
9190 if ( new_path && new_path != '/dev/null' ) {
9291 file_path = new_path
9392 } else if ( old_path && old_path != '/dev/null' ) {
9493 file_path = old_path
95- if ( new_path == '/dev/null' ) {
96- is_deleted = true
97- }
9894 }
9995
10096 if ( file_path ) {
@@ -104,26 +100,6 @@ const build_changes_markdown = (
104100
105101 changes_content += `### File: \`${ display_path } \`\n\n`
106102
107- let file_content = ''
108- try {
109- // Get the file content from the git revision we're diffing against.
110- file_content = execSync ( `git show ${ diff_base } :"./${ file_path } "` , {
111- cwd,
112- encoding : 'utf-8' ,
113- stdio : [ 'pipe' , 'pipe' , 'ignore' ] // Prevent git errors from crashing (e.g., file not on branch)
114- } )
115- } catch ( e ) {
116- // File likely did not exist on the branch (i.e., it's a new file).
117- // In this case, the original content is correctly an empty string.
118- if ( ! is_deleted ) {
119- Logger . warn ( {
120- function_name : 'build_changes_markdown' ,
121- message : `Could not get file content from git base ${ diff_base } for path ${ file_path } . Assuming it's a new file.` ,
122- data : e
123- } )
124- }
125- }
126-
127103 if ( path_prefix ) {
128104 full_file_diff = patch_diff_paths (
129105 full_file_diff ,
@@ -137,9 +113,6 @@ const build_changes_markdown = (
137113 full_file_diff = clean_git_diff ( full_file_diff )
138114
139115 changes_content += `\`\`\`\n${ full_file_diff } \n\`\`\`\n\n`
140- if ( file_content ) {
141- changes_content += `\`\`\`\n${ file_content } \n\`\`\`\n\n`
142- }
143116 }
144117 }
145118
@@ -449,15 +422,11 @@ const build_commit_changes_markdown = (
449422 : undefined
450423
451424 let file_path : string | undefined
452- let is_deleted = false
453425
454426 if ( new_path && new_path != '/dev/null' ) {
455427 file_path = new_path
456428 } else if ( old_path && old_path != '/dev/null' ) {
457429 file_path = old_path
458- if ( new_path == '/dev/null' ) {
459- is_deleted = true
460- }
461430 }
462431
463432 if ( file_path ) {
@@ -467,23 +436,6 @@ const build_commit_changes_markdown = (
467436
468437 changes_content += `### File: \`${ display_path } \`\n\n`
469438
470- let file_content = ''
471- if ( ! is_deleted ) {
472- try {
473- file_content = execSync ( `git show ${ commit_hash } :"./${ file_path } "` , {
474- cwd,
475- encoding : 'utf-8' ,
476- stdio : [ 'pipe' , 'pipe' , 'ignore' ]
477- } )
478- } catch ( e ) {
479- Logger . error ( {
480- function_name : 'build_commit_changes_markdown' ,
481- message : `Could not read file for diff from commit: ${ file_path } ` ,
482- data : e
483- } )
484- }
485- }
486-
487439 if ( path_prefix ) {
488440 full_file_diff = patch_diff_paths (
489441 full_file_diff ,
@@ -497,9 +449,6 @@ const build_commit_changes_markdown = (
497449 full_file_diff = clean_git_diff ( full_file_diff )
498450
499451 changes_content += `\`\`\`\n${ full_file_diff } \n\`\`\`\n\n`
500- if ( file_content ) {
501- changes_content += `\`\`\`\n${ file_content } \n\`\`\`\n\n`
502- }
503452 }
504453 }
505454
0 commit comments